On Thu, Dec 10, 2015 at 21:20:21 +0100, Alexander Neundorf wrote: > On Wednesday, December 09, 2015 17:35:28 Ben Boeckel wrote: > > So some behavior I was unaware of until today came up: > > > > set(var ON) > > option(var "description" OFF) > > message("var: ${var}") > > Assuming I wouldn't know about the subtle characteristics of normal vs. > cache variables, I think I would expect that var has the value of the option > afterwards. > > I.e. on the first run it would be OFF (since that's the default value of the > option), and all later runs it would have the value which is in the cache.
The problem with this behavior is that if I do -Dinternal_var:BOOL=OFF, it will override any variable of that name inside the project and it cannot override it without knowing it is in the cache to unset it so that the local variable is used again. This behavior also breaks cmake_dependent_option as-is since it sets a local variable to the fallback value if its requirements are not met (which is how it remembers the user decision when it becomes a viable option again). --Ben -- 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-developers