CMake include path

后端 未结 2 1609

In a C++ project, I would to include the header files as as descendants of the project\'s source directory without use of UNIX directory shortcuts . or .. . Im not sure how

相关标签:
2条回答
  • 2020-12-10 14:22

    put into root\CMakeList.txt:

    project(root)
    include_directories(${root_SOURCE_DIR}/include)
    ...
    

    you can use root_SOURCE_DIR everywhere in sub projects.

    for more information consider to visit http://www.cmake.org/Wiki/CMake_Useful_Variables#Variables_not_listed_here

    0 讨论(0)
  • 2020-12-10 14:33

    Use include_directories( include ) for CMakeLists.txt in Root folder. Or include_directories( ${CMAKE_SOURCE_DIR}/include ) from any subfolder.

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