Skip to content

Commit e6fde7c

Browse files
Merge pull request #147 from OpenMS/timosachsenberg-patch-7
Update to C++20
2 parents 3cdef5c + 9d9fe11 commit e6fde7c

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,27 +132,28 @@ PROJECT("OpenMS_CONTRIB")
132132
# quick manual for most commands: https://cmake.org/cmake/help/v3.3/manual/cmake-commands.7.html
133133
# useful predefined variables: http://www.paraview.org/Wiki/CMake_Useful_Variables
134134

135-
# force cmake > 3.1 to force enable c11 support
136-
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
135+
# force cmake > 3.10 to force enable c++20 support
136+
cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR)
137137

138138
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
139139

140140
# Set C++ version (does only work if we had a target-based CMake script)
141-
SET(CMAKE_CXX_STANDARD 11)
141+
SET(CMAKE_CXX_STANDARD 20)
142142
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
143143
# Until then, check again manually. MSVC is checked separately later
144+
# Update compiler version requirements for C++20 support
144145
if (UNIX)
145146
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
146-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.3")
147-
message(FATAL_ERROR "clang++: OpenMS-contrib requires version 3.3 to build but found ${CMAKE_CXX_COMPILER_VERSION}")
147+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0.0")
148+
message(FATAL_ERROR "clang++: OpenMS-contrib requires version 10.0.0 or later to build but found ${CMAKE_CXX_COMPILER_VERSION}")
148149
endif()
149150
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
150-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
151-
message(FATAL_ERROR "appleclang: OpenMS-contrib requires version 5.0.0 to build but found ${CMAKE_CXX_COMPILER_VERSION}")
151+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0.0")
152+
message(FATAL_ERROR "appleclang: OpenMS-contrib requires version 12.0.0 or later to build but found ${CMAKE_CXX_COMPILER_VERSION}")
152153
endif()
153154
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
154-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.2")
155-
message(FATAL_ERROR "g++: OpenMS-contrib requires version 4.7.2 to build but found ${CMAKE_CXX_COMPILER_VERSION}")
155+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0.0")
156+
message(FATAL_ERROR "g++: OpenMS-contrib requires version 10.0.0 or later to build but found ${CMAKE_CXX_COMPILER_VERSION}")
156157
endif()
157158
endif()
158159
endif()
@@ -473,8 +474,8 @@ if(APPLE)
473474
message(STATUS "${OSX_SYSROOT_FLAG}")
474475
endif()
475476

476-
# force cmake > 3.1 to force enable c11 support
477-
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
477+
# force cmake > 3.10 to force enable c++20 support
478+
cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR)
478479
endif()
479480

480481
## include extract/patch/build macros

0 commit comments

Comments
 (0)