Skip to content

Commit

Permalink
CMake >= 3.10 → all policies <= 71 are NEW by default
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed Sep 16, 2023
1 parent 5331803 commit ffd8d44
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 29 deletions.
5 changes: 0 additions & 5 deletions GNUInstallDirs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ Macros
absolute paths where necessary, using the same logic.
#]=======================================================================]

cmake_policy(PUSH)
cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced

# Convert a cache variable to PATH type

macro(_GNUInstallDirs_cache_convert_to_path var description)
Expand Down Expand Up @@ -380,5 +377,3 @@ foreach(dir
)
GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir})
endforeach()

cmake_policy(POP)
1 change: 0 additions & 1 deletion _unittests/test_pkg-config.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include(cmake/pkg-config.cmake)

cmake_policy(SET CMP0054 NEW)
# cmake -P
macro(EXPECT_STREQUAL _lhs _rhs)
if(NOT "${_lhs}" STREQUAL ${_rhs})
Expand Down
6 changes: 0 additions & 6 deletions base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,10 @@ endmacro(
# LIST : the list. VALUE : the value to be appended.
#
macro(_ADD_TO_LIST_IF_NOT_PRESENT LIST VALUE)
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)
# To be more robust, value should be stripped
if(NOT "${VALUE}" IN_LIST ${LIST})
list(APPEND ${LIST} "${VALUE}")
endif()
cmake_policy(POP)
endmacro(
_ADD_TO_LIST_IF_NOT_PRESENT
LIST
Expand Down Expand Up @@ -348,12 +345,9 @@ macro(COMPUTE_PROJECT_ARGS _project_VARIABLE)
set(_project_LANGUAGES "CXX")
endif()

# CMake >= 3.0
cmake_policy(SET CMP0048 NEW)
set(${_project_VARIABLE} VERSION ${PROJECT_VERSION_FULL} LANGUAGES
${_project_LANGUAGES})

# Append description for CMake >= 3.9
set(${_project_VARIABLE} ${${_project_VARIABLE}} DESCRIPTION
${PROJECT_DESCRIPTION})
endmacro(COMPUTE_PROJECT_ARGS)
Expand Down
4 changes: 0 additions & 4 deletions boost/FindBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,6 @@ Set ``Boost_NO_BOOST_CMAKE`` to ``ON``, to disable the search for boost-cmake.
include(FindPackageHandleStandardArgs)

# Save project's policies
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
if(POLICY CMP0102)
cmake_policy(SET CMP0102 NEW) # if mark_as_advanced(non_cache_var)
endif()
Expand Down Expand Up @@ -628,8 +626,6 @@ if (NOT Boost_NO_BOOST_CMAKE)
find_package_handle_standard_args(Boost HANDLE_COMPONENTS CONFIG_MODE)
_boost_set_legacy_variables_from_config()

# Restore project's policies
cmake_policy(POP)
return()
endif()
endif()
Expand Down
1 change: 0 additions & 1 deletion cmake_reinstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_policy(SET CMP0007 NEW)
if(EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
execute_process(COMMAND "@CMAKE_COMMAND@" --build "@PROJECT_BINARY_DIR@" --target uninstall --config $<CONFIGURATION>)
endif()
Expand Down
1 change: 0 additions & 1 deletion cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This files comes from the CMake FAQ: http://www.cmake.org/Wiki/CMake_FAQ
cmake_policy(SET CMP0007 NEW)
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
RETURN()
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
Expand Down
2 changes: 1 addition & 1 deletion cython/python/FindPython/Support.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This file is a "template" file used by various FindPython modules.
#

cmake_policy (VERSION 3.5)
cmake_policy (VERSION 3.10)

#
# Initial configuration
Expand Down
7 changes: 0 additions & 7 deletions find-external/OpenMP/FindOpenMP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ should use the ``OpenMP_<lang>_INCLUDE_DIRS`` _output_ variable if it needs
to know what include directories are needed.
#]=======================================================================]

cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW) # if() recognizes numbers and booleans
cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
cmake_policy(SET CMP0057 NEW) # if IN_LIST

function(_OPENMP_FLAG_CANDIDATES LANG)
if(NOT OpenMP_${LANG}_FLAG)
unset(OpenMP_FLAG_CANDIDATES)
Expand Down Expand Up @@ -775,5 +770,3 @@ unset(OpenMP_Fortran_TEST_SOURCE)
unset(OpenMP_C_CXX_CHECK_VERSION_SOURCE)
unset(OpenMP_Fortran_CHECK_VERSION_SOURCE)
unset(OpenMP_Fortran_INCLUDE_LINE)

cmake_policy(POP)
3 changes: 0 additions & 3 deletions version-script.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ include(CheckCCompilerFlag)
if(${CMAKE_VERSION} VERSION_LESS 3.18.0)
# Do nothing
else()
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
include(CheckLinkerFlag)
cmake_policy(POP)
endif()

# _CHECK_VERSION_SCRIPT_SUPPORT
Expand Down

0 comments on commit ffd8d44

Please sign in to comment.