Hi all, I'm struggling with the following. While processing the CMakeLists.txt files of my project, I want to keep track of include directories and libraries of "external" packages in say MYPROJECT_INCLUDE_DIRS and MYPROJECT_LIBRARIES. These variables need to be augmented with new values while processing subdirectories of myproject (that were added with add_subdirectory()). I wrote a small wrapper macro around find_package() that updates these variables, which can be used in my CMakeLists.txt files.
However, I noticed that in a subdirectory I can read the variable, but changes don't get passed back, unless I use PARENT_SCOPE. This is a bit cumbersome and error-prone, because you must set the variable with PARENT_SCOPE at each level, even if you don't intend to modify its contents! Is there a way to define "real" global variables, without using the cache? Best regards, Marcel Loose. _______________________________________________ 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