CMake includes the path

In a C ++ project, I would like to include header files as descendants of the project’s source directory without using UNIX directory shortcuts. or ... I'm not sure how to configure cmake to work with this.

I have a directory structure:

Root |-include | |- foo.h |-src | | foo.cpp 
+6
source share
2 answers

put in root \ CMakeList.txt:

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

you can use root_SOURCE_DIR everywhere in subprojects.

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

+11
source

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

+12
source

All Articles