I have a function that I define in my top-most CMakeLists.txt file (on Windows using CMake version 2.8.6) called define_project() that calls add_executable, sets up compile defintions, etc etc.
For each time define_project() is called *anywhere* in the directory hierarchy, I need to increment a global "project_count" variable to keep track of how many projects were created and print that at the very end of the root CMakeLists.txt file. So far my attempts at this have been unsuccessful. I tried creating a cache variable in the root script: set( project_count 0 CACHE INTERNAL "" ) Then inside of my function, I do this: function( define_project ... ) math( EXPR count "${project_count}+1" ) set( project_count ${count} ) endfunction() However, 'project_count' is always 0 each time that the function is executed. How can I make this work? --------- Robert Dailey
-- 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