[CMake] unset() command
Brad King
brad.king at kitware.com
Wed Aug 20 10:54:33 EDT 2008
Philip Lowman wrote:
> So I submitted a patch to add a new unset() command to CMake. The
> command will unset normal or cache variables (causing them to become
> undefined). The command also supports unsetting environment variables,
> in case anyone has to do that.
>
> The primary use case that drove me to implement this was this:
>
> find_library(FOO_LIBRARY foo)
> if(MSVC OR SEARCH_FOO_DEBUG)
> find_library(FOO_LIBRARY_DEBUG food)
> else()
> unset(FOO_LIBRARY_DEBUG)
> set(FOO_LIBRARY_DEBUG ${FOO_LIBRARY})
> endif()
>
> http://public.kitware.com/Bug/view.php?id=7507
Okay, I see Bill wanted the discussion to be here, so ignore my other
message.
The "set" command already supports unsetting:
set(FOO xyz)
set(FOO) # unsets
if(DEFINED FOO)
message("This message does not appear.")
endif(DEFINED FOO)
I think it should just be fixed for CACHE and ENV variables.
-Brad
More information about the CMake
mailing list