[CMake] Pass variables to sub directory CMakeLists.txt

Vandenbroucke Sander Sander.Vandenbroucke at vandewiele.com
Thu Feb 21 02:25:49 EST 2008


Hi,

I want to pass a variable to CMakeLists.txt's in sub directories:

Top directory CMakeLists.txt:
set( VAR1 "" )
add_subdirectory (subdir1)
add_subdirectory (subdir2)

Each subdir CMakeLists.txt:

...
set( VAR1 "${VAR1} extend_var1" )
...

I use VAR1 later on in the linker.

How can I make this work?

Kind regards,
Sander.



More information about the CMake mailing list