cmake: Make variables show up if previously hidden

Previously if a variable had unmet dependencies and had been hidden, by being made
an internal variable, it would not have been unhidden by the use of `option`. This
emulates the behaviour of `option` that we were wanting, but additionally using `FORCE`
to override the `INTERNAL` setting
This commit is contained in:
Adrian Danis
2017-11-03 16:34:05 +11:00
parent 24a69963e7
commit aa3fc06c79

View File

@@ -191,7 +191,12 @@ function(config_option optionname configname doc)
endforeach()
endif()
if(valid)
option(${optionname} "${doc}" ${CONFIG_DEFAULT})
# Check for an existing value, and set the option to that, otherwise use the default
if(DEFINED ${optionname})
set(${optionname} "${${optionname}}" CACHE BOOL "${doc}" FORCE)
else()
set(${optionname} "${CONFIG_DEFAULT}" CACHE BOOL "${doc}" FORCE)
endif()
else()
set(${optionname} "${CONFIG_DEFAULT_DISABLED}" CACHE INTERNAL "${doc}")
endif()