How can I prevent variables cache pollution in CMAKE? My real problem is the following:
I have library A and library B, both libraries have some cmake variable used to configure there and there and that's ok, but what when variables are semantically duplicated? Library A depends on Library B both libraries provide "CompileForLinux" cache variable, I want be able to just compile library A and check the checkbox for "CompileForLinux" just once. This example is the minimum of course, but it would be nice if there's someway to wrap variables of dependencies so that I can compile a library with less chance of "human error prone" misconfiguration and to provide final user of library A only the few real needed options/variables. Libray A is actually including library B using "add_subdirectory" So assume the following boolean cache variables: LIBA_STATIC LIBA_SHARED LIBA_OBJECT LIBB_STATIC LIBB_SHARED LIBB_OBJECT LIBA_EXCLUDE_MODULE1 LIBB_EXCLUDE_MODULE1 COMPILE_FOR_LINUX #from libA COMPILE_FOR_LINUX #from libB It would be nice letting LIB A to hide unecessary staff that can be configured by the cmake script without the user have to know it. Final expected list to be showed in Cmake-gui LIBA_STATIC # configure libB accordingly LIBA_SHARED LIBA_OBJECT LIBA_EXCLUDE_MODULE1 LIBB_EXCLUDE_MODULE1 #not hided by libA because necessary for final configuration COMPILE_FOR_LINUX #from libA I Hope you see how that can be tremendously usefulll especially in opensource cross-platform projects with many dependencies
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake