CMake and using git-submodule for dependence projects

前端 未结 1 1674
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-05 08:47

Consider the following three projects.

ProjectA does not have any dependencies and its CMakeLists.txt at top level is like the following,

相关标签:
1条回答
  • 2021-01-05 08:55

    You can check whether the target a already exists before calling add_subdirectory:

    if (NOT TARGET a)
      add_subdirectory(ProjectA)
    endif ()
    

    so that it only adds the subdirectory once for your whole CMake project.

    0 讨论(0)
提交回复
热议问题