Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
Just as
set(VAR "")
sets VAR to an empty string in the current scope, the code
set(VAR "" PARENT_SCOPE)
is documented to set the variable to an empty string in the parent
scope. Fix the implementation to make it so.
The code "set(VAR PARENT_SCOPE)" unsets VAR in the parent scope.
Implement this case explicitly next to where "set(VAR)" is explicitly
handled to unset VAR in the current scope.
We revert commit "Create CMake Policy CMP0015 to fix set(CACHE)" because
the NEW behavior of the policy breaks a valid use case:
# CMakeLists.txt
option(BUILD_SHARED_LIBS "..." ON)
add_library(mylib ...)
set(BUILD_SHARED_LIBS OFF) # we want only mylib to be shared
add_subdirectory(ThirdParty)
# ThirdParty/CMakeLists.txt
option(BUILD_SHARED_LIBS "..." ON)
# uh, oh, with NEW behavior this dir uses shared libs!!!
We'll re-introduce the policy later with a different change in behavior
to resolve the motivating case, which was more subtle but less common.
See issue #9008.
This converts the CMake license to a pure 3-clause OSI-approved BSD
License. We drop the previous license clause requiring modified
versions to be plainly marked. We also update the CMake copyright to
cover the full development time range.
The GNU compiler warns about possible operator precedence mistakes and
asks for explicit parentheses (-Wparentheses). We add the parentheses
to silence the warning. This also fixes one real logic error in the
find_package() implementation by correcting expression evaluation order.
The set(CACHE) and option() commands should always expose the cache
value. Previously we failed to expose the value when it was already set
if a local variable definition hid it. When set to NEW, this policy
tells the commands to always remove the local variable definition to
expose the cache value. See issue #9008.