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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Luigi
Calori
Sent: Thursday, March 15, 2007 12:06 PM
To: cmake@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@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to