Skip to content

Commit

Permalink
ENH: Upgrade ITK from C++11 to C++14
Browse files Browse the repository at this point in the history
Follow-up to commit babb677
"COMP: Enforce building ITK with C++11", Hans Johnson, 19 January 2018
  • Loading branch information
N-Dekker committed Jun 1, 2021
1 parent cd36c64 commit daec0fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions CMake/itkCompilerChecks.cmake
Expand Up @@ -28,13 +28,13 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND
message(FATAL_ERROR "Intel C++ (ICC) 14.0 or later is required.")
endif ()

# Make sure we have C++11 enabled.
if(NOT ITK_IGNORE_CMAKE_CXX11_CHECKS)
# Make sure we have C++14 enabled.
if(NOT ITK_IGNORE_CMAKE_CXX14_CHECKS)
# Needed to make sure libraries and executables not built by the
# itkModuleMacros still have the C++11 compiler flags enabled
# itkModuleMacros still have the C++14 compiler flags enabled
# Wrap this in an escape hatch for unknown compilers
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11) # Supported values are ``11``, ``14``, and ``17``.
set(CMAKE_CXX_STANDARD 14) # Supported values are 14, 17, 20, and 23.
endif()
if(NOT CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Expand Up @@ -35,15 +35,15 @@ foreach(pold "CMP0120") # CMP0120 will require non-trivial effort to address
endif()
endforeach()

# ==== Define language standard configurations requiring at least c++11 standard
if(CMAKE_CXX_STANDARD EQUAL "98" )
message(FATAL_ERROR "CMAKE_CXX_STANDARD:STRING=98 is not supported in ITK version 5 and greater.")
# ==== Define language standard configurations requiring at least c++14 standard
if(CMAKE_CXX_STANDARD EQUAL "98" OR CMAKE_CXX_STANDARD LESS "14")
message(FATAL_ERROR "C++98 to C++11 are no longer supported in ITK version 5.3 and greater.")
endif()

#####
## Set the default target properties for ITK
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11) # Supported values are ``11``, ``14``, and ``17``.
set(CMAKE_CXX_STANDARD 14) # Supported values are 14, 17, 20, and 23.
endif()
if(NOT CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down

0 comments on commit daec0fd

Please sign in to comment.