simple cmake file with python projects

Hi all

 

I am a complete noob to CMAKE and am mostly a Python developer. However, I am now in a situation where I need to use a lot of C++ in my project, which is why I'm trying to use clion instead of pycharm now. So, my project structure is as follows:

 

project_root

     - python_subproject_1

     - python_subproject_2

     - python_subproject_3

     - python_subproject_4

     - big c++ project with its own cmake (Open3D)

 

What would a simple cmake file look like for everything to run smoothly? 

 

For now I simply have the following CMakeLists.txt file in the project root folder:

cmake_minimum_required(VERSION 3.12.0)
project(main_project)
add_subdirectory(python_subproject_1)
add_subdirectory(python_subproject_2)
add_subdirectory(python_subproject_3)
add_subdirectory(python_subproject_4)

and in each python_subproject, I simply have

cmake_minimum_required(VERSION 3.12.0)
project(python_subproject_i)

as the CMakeLists.txt. Is that correct so far?

As for Open3D, adding

add_subdirectory(Open3D)

doesn't work, as I get the error:

CMake Error at Open3D/src/CMakeLists.txt:7 (target_compile_options): Cannot specify compile options for target "Open3D" which is not built by this project.

 

So, any help to set up cmake correctly for my project structure would be greatly appreciated :)

0

请先登录再写评论。