[CMake] How to get a variable that is defined in
another CMakeLists.txt file
Sylvain Benner
benner at virtools.com
Wed Dec 20 04:29:29 EST 2006
You can inherit from the top level CMakelists.txt variables.
So if the GET_DIRECTORY_PROPERTY command does not work for your case,
you can use the SET command in the top level CMakeLists.txt which calls
the command ADD_SUBDIRECTORY of your libraries A and B.
Something like:
IF(condition)
SET (PROJECT_A_LIB_NAME MyLib)
ADD_SUBDIRECTORY(A_Directory)
ENDIF(condition)
Then you can safely try to read the PROJECT_A_LIB_NAME variable in the
CMakeLists.txt of lib B.
-Sylvain
More information about the CMake
mailing list