[CMake] Appending paths to a variable

Oliver Dole odole at sand-labs.org
Wed Feb 20 08:06:05 EST 2008


Hello,

On 2/20/08, Robert Bielik <robert.bielik at xponaut.se> wrote:
> I have a structure where I include all subdirs via FILE(GLOB.. and FOREACH
> and within each subdir CMakeLists.txt I want to add a path to be used with
> INCLUDE_DIRECTORIES in the main CMakeLists.txt
>
> I tried SET(INCL_DIRS ${INCL_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include) but the
> INCL_DIRS variable is empty when I get "back" to the main CMakeLists.txt file...
>
> How to?
To retrieve a variable from a subdirectory (added via
ADD_SUBDIRECTORY), you have to do something like:
GET_DIRECTORY_PROPERTY (MYVAR DIRECTORY subdirectory DEFINITION INCL_DIRS)
Have a look at cmake documentation for more info about GET_DIRECTORY_PROPERTY.

Regards,

> TIA
> /R
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


-- 
Olivier DOLE
Software Engineer


More information about the CMake mailing list