[CMake] getting values from subdirs

Luigi Calori l.calori at cineca.it
Thu Mar 15 11:35:48 EST 2007


Ken Martin wrote:

>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
>
>  
>
I' v etried... but this don' t work:

i have
 

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

and seem that the init code in the main get galled before each subdir (this is a known issue)....
I was searching for a workaround...


>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