On 7. Jul, 2010, at 14:45 , Mathieu Malaterre wrote: > On Wed, Jul 7, 2010 at 1:07 PM, Bo Thorsen <b...@askmonty.org> wrote: >> Den 07-07-2010 12:34, Mathieu Malaterre skrev: >>> >>> Hi there, >>> >>> I am wondering if I am missing anything here. How would one >>> propagate a variable across subdirectories in cmake ? I thought that a >>> simple CACHE variable would do the trick, but using cmake 2.8.1 I had >>> to do the following trick >>> >>> list(APPEND v "42") >>> # make sure to actually update the CACHE variable: >>> set(v ${v} CACHE INTERNAL "toto") >>> >>> My goal is that at the end of the toplevel cmakelists.txt file, cmake >>> would have collected a list of installation path. >> >> http://www.cmake.org/pipermail/cmake/2010-May/036743.html >> > > Unless I am missing -again- something, this does not work across directories: > > https://gdcm.svn.sourceforge.net/svnroot/gdcm/Sandbox/CMakeBug/14 > > > Thanks > -- > Mathieu
Make that: project(bla NONE) set_property(GLOBAL PROPERTY v "13") add_subdirectory(foo) get_property(v GLOBAL PROPERTY v) message("final v: ${v}") For properties you must always use getters and setters, they are never directly mapped to variables. Michael _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake