Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update minimum required cmake #765

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
COMP: Update CMake minimum required version from 2.8.9 to 3.5
This commit removes few workarounds and explicit setting of CMake policies.

It also ensures the required CMake version support VS 2015 (introduced in CMake 3.1)

CMake 3.5 is also old enough (release in April 2016) and available (same version
or above) in distributions like these ones:

* Arch Linux
* Ubuntu LTS 14.04, 16.04
* OpenSUSE Leap 42.2, 42.3
* Debian 9, Sid
* Fedora 24/25/26
* Slackware 14.2

See https://pkgs.org/download/cmake
  • Loading branch information
jcfr committed Aug 3, 2017
commit 2efbc9c91abc2667943b299c78aded6291503886
22 changes: 1 addition & 21 deletions CMake/SlicerCPack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,9 @@ if(NOT APPLE)
if(NOT DEFINED CMAKE_INSTALL_OPENMP_LIBRARIES)
set(CMAKE_INSTALL_OPENMP_LIBRARIES ON)
endif()
if(MSVC AND CMAKE_VERSION VERSION_LESS "3.1" AND CMAKE_INSTALL_OPENMP_LIBRARIES)
message(WARNING "Skipping installation of OpenMP libraries. "
"Upgrade from CMake ${CMAKE_VERSION} to CMake >= 3.1 to install them.")
endif()
set(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT "RuntimeLibraries")
include(InstallRequiredSystemLibraries)

# XXX: Remove this once CMake minimum version has been updated.
# See Slicer issue #3972 and CMake issue #15428
if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP)
if(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION)
if(WIN32)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin)
else()
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib)
endif()
endif()
install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}
COMPONENT RuntimeLibraries)
endif()
endif()

include(${Slicer_CMAKE_DIR}/SlicerBlockInstallCMakeProjects.cmake)

else()
Expand Down
10 changes: 0 additions & 10 deletions CMake/SlicerCPackBundleFixup.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
include(@CMAKE_SOURCE_DIR@/CMake/BundleUtilitiesWithRPath.cmake)
#include(BundleUtilities)

#
# Avoid following symlinks encountered during FILE GLOB_RECURSE calls:
#
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0009 NEW)
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif()
endif()

#-----------------------------------------------------------------------------
set(PYTHON_STDLIB_SUBDIR "@PYTHON_STDLIB_SUBDIR@")
set(PYTHON_SITE_PACKAGES_SUBDIR "@PYTHON_SITE_PACKAGES_SUBDIR@")
Expand Down
17 changes: 0 additions & 17 deletions CMake/SlicerCPackBundleVerify.cmake
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@

#
# Make sure this CMake has BundleUtilities.cmake:
#
if(NOT EXISTS "${CMAKE_ROOT}/Modules/BundleUtilities.cmake")
message(FATAL_ERROR "error: BundleUtilities.cmake not found. Use CMake 2.8.3 or later.")
endif()
include(BundleUtilities)

#
# Avoid following symlinks encountered during FILE GLOB_RECURSE calls:
#
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0009 NEW)
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif()
endif()


# Sanity checks
set(expected_existing_vars Slicer_INSTALL_DIR Slicer_MAIN_PROJECT_APPLICATION_NAME)
foreach(var ${expected_existing_vars})
Expand Down
2 changes: 2 additions & 0 deletions CMake/SlicerConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
# ConfigurePrerequisites | Slicer_USE_CONFIGUREPREREQUISITES
# --------------------------------------------------------------------------

cmake_minimum_required(VERSION 3.3)

foreach(component NoExtensionSupport ConfigurePrerequisites)
string(TOUPPER ${component} _COMPONENT)
set(Slicer_USE_${_COMPONENT} 0)
Expand Down
10 changes: 0 additions & 10 deletions CMake/SlicerExtensionCPackBundleFixup.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}")
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX is set to a nonexistent directory :(")
endif()

#
# Avoid following symlinks encountered during FILE GLOB_RECURSE calls:
#
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0009 NEW)
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif()
endif()

#-----------------------------------------------------------------------------
# gp_log_message - Convenient function allowing to both display and log a message.
# Log file: $ENV{DESTDIR}/../complete-bundles-log.txt
Expand Down
3 changes: 0 additions & 3 deletions CMake/UseSlicer.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ endif()
if(NOT DEFINED ${EXTENSION_NAME}_SOURCE_DIR
AND NOT DEFINED ${EXTENSION_NAME}_BINARY_DIR
AND NOT Slicer_DONT_USE_EXTENSION)
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
project(${EXTENSION_NAME})
endif()

Expand Down
2 changes: 1 addition & 1 deletion CMake/UseSlicerMacros.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.4)
cmake_minimum_required(VERSION 3.3)

# Given a variable name, this function will display messages indicating what the current
# value of the variable.
Expand Down
15 changes: 2 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@

cmake_minimum_required(VERSION 2.8.9)
if(POLICY CMP0017)
cmake_policy(SET CMP0017 OLD)
endif()
foreach(p
CMP0048 # CMake 3.0
CMP0054 # CMake 3.1
CMP0020 # CMake 2.8.11
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
cmake_minimum_required(VERSION 3.3)
cmake_policy(SET CMP0017 OLD)

#-----------------------------------------------------------------------------
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
Expand Down
13 changes: 2 additions & 11 deletions Extensions/CMake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.4)
cmake_minimum_required(VERSION 3.3)
#-----------------------------------------------------------------------------

if(Slicer_SOURCE_DIR)
Expand All @@ -14,17 +14,8 @@ if(APPLE)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMake/SlicerBlockSetCMakeOSXVariables.cmake)
endif()

if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW) # CMake 3.0.0
endif()
project(SlicerExtensions)

#-----------------------------------------------------------------------------
# See http:https://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details
#-----------------------------------------------------------------------------
if(POLICY CMP0017)
cmake_policy(SET CMP0017 OLD)
endif()
cmake_policy(SET CMP0017 OLD)

#-----------------------------------------------------------------------------
set(_url $ENV{MIDAS_PACKAGE_URL})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ if(NOT DEFINED Slicer_EXTENSIONS_CMAKE_DIR)
set(Slicer_EXTENSIONS_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
endif()

foreach(p
CMP0054 # CMake 3.1
CMP0064 # CMake 3.4
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()

#
# slicerFunctionExtractExtensionDescription(EXTENSION_FILE <file> VAR_PREFIX <var-prefix>)
# is used to extract information associated with a given extension <file>.
Expand Down