[CMake] getting values from subdirs

Ken Martin ken.martin at kitware.com
Thu Mar 15 11:17:50 EST 2007


I believe the following will work. In the top CMakeLists file...

set(myvar initial-value CACHE INTERNAL "stored subdir values")
add_subdirectory(subdir)
message("${myvar}")

Then in subdir....

set(myvar ${myvar} ${other-values-from-this-subdir} CACHE INTERNAL "stored
subdir values")

Ken


Ken Martin PhD 
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971 

-----Original Message-----
From: cmake-bounces+ken.martin=kitware.com at cmake.org
[mailto:cmake-bounces+ken.martin=kitware.com at cmake.org] On Behalf Of Luigi
Calori
Sent: Thursday, March 15, 2007 12:06 PM
To: cmake at cmake.org
Subject: [CMake] getting values from subdirs

I would like to being able to collect a list of values from a macro that 
get called from several subdirs
The obvious solutions to init it into the main CMakeLists and update 
whithin the macro does not work as (probably) the init inside the main 
CmakeLists get executed
anyway for each subdir
If declare it CACH INTERNAL and I do no init, it get updated but retain 
values on different CMake runs.... any thougt?
A possible solution is to write a file....but it does not seem much elegant

Thanks anyway for the help
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list