Skip to content

Commit b01b325

Browse files
committed
COMP: Increased min cmake from 3.10.2 to 3.16.3
Removed some workarounds for older version of cmake. Part of the motivation here is HDF's increasing of their minumum.
1 parent 18ae750 commit b01b325

File tree

22 files changed

+39
-89
lines changed

22 files changed

+39
-89
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
command: |
4949
sudo apt-get install -y rsync ninja-build ccache
5050
sudo pip install --upgrade pip
51-
sudo pip install cmake==3.11.4 scikit-ci-addons numpy
51+
sudo pip install cmake==3.16.3 scikit-ci-addons numpy
5252
- run:
5353
name: CCache initialization
5454
command: |

CMake/ITKModuleTest.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,7 @@ function(CreateGoogleTestDriver KIT KIT_LIBS KitTests)
253253

254254
include(GoogleTest)
255255

256-
# CMake 3.10 added this method, to avoid configure time introspection.
257-
# Verion 3.10.3 is needed for the DISCOVERY_TIMEOUT method
258-
if(NOT CMAKE_CROSSCOMPILING AND NOT ${CMAKE_VERSION} VERSION_LESS "3.10.3" )
256+
if(NOT CMAKE_CROSSCOMPILING)
259257
gtest_discover_tests( ${exe} DISCOVERY_TIMEOUT 15 )
260258
else()
261259
set(_skip_dependency)

CMake/ITKSetPython3Vars.cmake

Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,27 @@
1-
# This file provides a work-around to provide consistent
2-
# python3 cmake variables for cmake versions pre/post 3.12.0
3-
41
# If the cmake variable "PYTHON_DEVELOPMENT_REQUIRED" is set to ON
52
# then the development environments are found.
63

7-
# CMake < 3.15 will use deprecated search by PythonInterp and PythonLibs.
8-
9-
# CMake >= 3.15 will use FindPython3 and can be controlled accordingly (i.e. setting Python3_ROOT_DIR or
4+
# CMake will use FindPython3 and can be controlled accordingly (i.e. setting Python3_ROOT_DIR or
105
# Python3_FIND_REGISTRY (useful if using PATH to specify Python3 version on Windows).
116
# Additionally, setting Python3_EXECUTABLE can be used to set the Python version explicitly, but
127
# may become less reliable with newer versions of CMake (as opposed setting FindPython3 HINTS). Current
138
# implementation gives preference to active virtualenvs.
149

15-
if("${CMAKE_VERSION}" VERSION_LESS_EQUAL "3.15.0")
16-
# CMake < 3.15 will use deprecated search by PythonInterp and PythonLibs.
17-
# Use of PythonInterp and PythonLibs is deprecated since cmake version 3.12.0
18-
# Unstable behavior of FindPython between CMake 3.12 and 3.15, so including in this
19-
# Only use deprecated mechanisms for older versions of cmake
20-
#
21-
set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6)
22-
find_package(PythonInterp)
23-
if(PYTHON_DEVELOPMENT_REQUIRED)
24-
find_package(PythonLibs REQUIRED)
25-
# check for version mismatch.
26-
if(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND
27-
AND NOT(PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING))
28-
message(FATAL_ERROR "Python executable (\"${PYTHON_VERSION_STRING}\") and library (\"${PYTHONLIBS_VERSION_STRING}\") version mismatch.")
29-
endif()
30-
endif()
31-
if(PYTHON_VERSION_STRING VERSION_LESS 3.6)
32-
# if python version is less than 3.6, unset so that it appears that no python version is found.
33-
# to emulate the same behavior as find(Python3 ..) from cmake 3.12.0+
34-
unset(PYTHON_EXECUTABLE)
35-
unset(PYTHONINTERP_FOUND)
36-
unset(PYTHON_VERSION_STRING)
37-
unset(PYTHON_INCLUDE_DIRS)
38-
else()
39-
## For forward compatibility with cmake 3.12.0 or greater, emulate variable names from FindPython3.cmake
40-
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
41-
set(Python3_Interpreter_FOUND ${PYTHONINTERP_FOUND})
42-
set(Python3_VERSION ${PYTHON_VERSION_STRING})
43-
44-
set(Python3_Development_FOUND ${PYTHONLIBS_FOUND})
45-
set(Python3_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
46-
set(Python3_LIBRARIES ${PYTHON_LIBRARIES})
47-
endif()
48-
else()
49-
cmake_policy(SET CMP0094 NEW) # makes FindPython3 prefer activated virtualenv Python to latest version
50-
if(PYTHON_DEVELOPMENT_REQUIRED)
51-
if(DEFINED Python3_EXECUTABLE) # if already specified
52-
set(_specified_Python3_EXECUTABLE ${Python3_EXECUTABLE})
53-
endif()
54-
# set(Python3_FIND_REGISTRY LAST) # default is FIRST. Do we need/want this?
55-
find_package(Python3 COMPONENTS Interpreter Development)
56-
if(DEFINED _specified_Python3_EXECUTABLE)
57-
set(Python3_EXECUTABLE ${_specified_Python3_EXECUTABLE} CACHE INTERNAL
58-
"Path to the Python interpreter" FORCE)
59-
endif()
60-
else() # if not PYTHON_DEVELOPMENT_REQUIRED, just find some version of Python (don't need to be as specific)
61-
find_package(Python3 COMPONENTS Interpreter)
10+
cmake_policy(SET CMP0094 NEW) # makes FindPython3 prefer activated virtualenv Python to latest version
11+
if(PYTHON_DEVELOPMENT_REQUIRED)
12+
if(DEFINED Python3_EXECUTABLE) # if already specified
13+
set(_specified_Python3_EXECUTABLE ${Python3_EXECUTABLE})
6214
endif()
63-
if(NOT Python3_EXECUTABLE AND _Python3_EXECUTABLE) # workaround for cases where FindPython3 fails to set correctly
64-
set(Python3_EXECUTABLE ${_Python3_EXECUTABLE} CACHE INTERNAL
15+
# set(Python3_FIND_REGISTRY LAST) # default is FIRST. Do we need/want this?
16+
find_package(Python3 COMPONENTS Interpreter Development)
17+
if(DEFINED _specified_Python3_EXECUTABLE)
18+
set(Python3_EXECUTABLE ${_specified_Python3_EXECUTABLE} CACHE INTERNAL
6519
"Path to the Python interpreter" FORCE)
6620
endif()
21+
else() # if not PYTHON_DEVELOPMENT_REQUIRED, just find some version of Python (don't need to be as specific)
22+
find_package(Python3 COMPONENTS Interpreter)
23+
endif()
24+
if(NOT Python3_EXECUTABLE AND _Python3_EXECUTABLE) # workaround for cases where FindPython3 fails to set correctly
25+
set(Python3_EXECUTABLE ${_Python3_EXECUTABLE} CACHE INTERNAL
26+
"Path to the Python interpreter" FORCE)
6727
endif()

CMake/ITKSetStandardCompilerFlags.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121

2222
include(CheckCXXCompilerFlag)
2323
include(CheckCCompilerFlag)
24-
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.14.0)
25-
include(CheckPIESupported)
26-
check_pie_supported()
27-
endif()
24+
include(CheckPIESupported)
25+
check_pie_supported()
2826

2927
function(check_c_compiler_flags c_flag_var)
3028
set(local_c_flags "")

CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# CMake versions greater than the ITK_NEWEST_VALIDATED_POLICIES_VERSION policies will
1111
# continue to generate policy warnings "CMake Warning (dev)...Policy CMP0XXX is not set:"
1212
#
13-
set(ITK_OLDEST_VALIDATED_POLICIES_VERSION "3.10.2")
13+
set(ITK_OLDEST_VALIDATED_POLICIES_VERSION "3.16.3")
1414
set(ITK_NEWEST_VALIDATED_POLICIES_VERSION "3.19.7")
1515
cmake_minimum_required(VERSION ${ITK_OLDEST_VALIDATED_POLICIES_VERSION} FATAL_ERROR)
1616
if("${CMAKE_VERSION}" VERSION_LESS_EQUAL "${ITK_NEWEST_VALIDATED_POLICIES_VERSION}")
@@ -242,14 +242,8 @@ set(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Generate debug library name with a post
242242
mark_as_advanced(CMAKE_DEBUG_POSTFIX)
243243

244244
# Configure find_package behavior
245-
if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.16")
246-
if(NOT DEFINED CMAKE_FIND_USE_PACKAGE_REGISTRY)
247-
set(CMAKE_FIND_USE_PACKAGE_REGISTRY 0)
248-
endif()
249-
else()
250-
if(NOT DEFINED CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
251-
set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY 1)
252-
endif()
245+
if(NOT DEFINED CMAKE_FIND_USE_PACKAGE_REGISTRY)
246+
set(CMAKE_FIND_USE_PACKAGE_REGISTRY 0)
253247
endif()
254248

255249
# Setup build locations for shared libraries ----START

Examples/Installation/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This is the root ITK CMakeLists file.
2-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
2+
cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR)
33
foreach(p
44
## Only policies introduced after the cmake_minimum_required
55
## version need to explicitly be set to NEW.

Modules/Bridge/NumPy/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2)
1+
cmake_minimum_required(VERSION 3.16.3)
22
project(ITKBridgeNumPy)
33

44
set(ITKBridgeNumPy_SYSTEM_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")

Modules/Core/Common/CMake/itkCheckPrivateDynamicCast.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int main(void)
5252
# accomplished with a custom command as a post build step for the
5353
# compilation of the executable.
5454
file(WRITE "${test_project_dir}/CMakeLists.txt" "
55-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
55+
cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR)
5656
foreach(p
5757
## Only policies introduced after the cmake_minimum_required
5858
## version need to explicitly be set to NEW.

Modules/Core/GPUCommon/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR)
22
project(ITKGPUCommon)
33

44
if(NOT ITK_SOURCE_DIR)

Modules/Core/GPUFiniteDifference/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR)
22
project(ITKGPUFiniteDifference)
33

44
if(NOT ITK_SOURCE_DIR)

0 commit comments

Comments
 (0)