[CMake] when are variables inherited?
Sylvain Benner
benner at virtools.com
Wed Sep 26 11:13:47 EDT 2007
> I still don't understand when variables are inherited by subdirectories.
> I see that if I define the variable using cmake -D then it is the same
> in all subdirectories. I guess I could use an environment variable.
> However, if I do something like:
>
> SET (FINITO_INSTALL_DIR /Users/jgonzalez/financial/finito/trunk CACHE
> PATH "finito-dir")
>
> it is not inherited by subdirectories. What am I missing
Hello,
Which command do you use for subdirectories ?
Be sure to use ADD_SUBDIRECTORY and not SUBDIRS which is an old command
left in current release for compatibility purpose.
The behavior of ADD_SUBDIRECTORY is that each CMakeLists.txt added with
this command inherits from the variables set in the caller CMakeLists.txt.
--Sylvain
More information about the CMake
mailing list