>
> This works:
> set( project_count 0 CACHE INTERNAL "")
> function( define_project )
> math( EXPR count "${project_count}+1" )
> set( project_count ${count} CACHE INTERNAL "")
> endfunction()
> define_project()
> message(${project_count})
> define_project()
> message(${project_count})
> define_project()
> message(${project_count})
> It prints out
> 1
2
> 3
Unfortunately this isn't a valid test case.
You need to add each call to define_project() into a CMakeLists.txt script
in a subdirectory, and then call add_subdirectory() from the root script. It
won't work in that case in my tests.
--
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