Skip to content

Commit 87d34b9

Browse files
committed
Port to C++-17
1 parent 550f30f commit 87d34b9

8 files changed

+4
-29
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.0)
33
include(cmake/modules/mgis.cmake)
44
project("mfront-generic-interface")
55

6+
set(CMAKE_CXX_STANDARD 17)
7+
set(CXX_STANDARD_REQUIRED ON)
8+
69
# portable-build
710
option(enable-portable-build "produce binary that can be shared between various machine (same architecture, same gcc version, different processors" OFF)
811

cmake/modules/clang.cmake

-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ if(enable-libcxx)
4444
tfel_enable_cxx_compiler_flag(COMPILER_CXXFLAGS "stdlib=libc++")
4545
endif(enable-libcxx)
4646

47-
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.4)
48-
message(FATAL_ERROR "C++11 support is only available for clang version >= 3.4")
49-
endif(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.4)
50-
set(COMPILER_CXXFLAGS "${COMPILER_CXXFLAGS} -std=c++11")
51-
5247
option(enable-sanitize-options "enable various clang sanitize options (undefined, address,...)" OFF)
5348

5449
if(enable-sanitize-options)

cmake/modules/compiler.cmake

-5
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
140140
include(cmake/modules/intel.cmake)
141141
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "PathScale") OR (PATHSCALE_COMPILER))
142142
include(cmake/modules/pathscale.cmake)
143-
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
144-
set(COMPILER_CXXFLAGS "${COMPILER_CXXFLAGS} -std=c++11")
145-
set(OPTIMISATION_FLAGS "-DNO_RUNTIME_CHECK_BOUNDS ${OPTIMISATION_FLAGS}")
146-
# add_definitions("-library=stlport4")
147-
# message(FATAL_ERROR "MFRONT C++11 support is not availabable with the SunPro compiler")
148143
elseif(MSVC)
149144
include(cmake/modules/msvc.cmake)
150145
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")

cmake/modules/gcc.cmake

-13
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,6 @@ if(enable-sanitize-options)
107107
tfel_enable_cxx_compiler_flag(COMPILER_FLAGS "fno-omit-frame-pointer")
108108
endif(enable-sanitize-options)
109109

110-
option(enable-cxx-17 "enable support of the C++17 standard")
111-
if(enable-cxx-17)
112-
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 7.2)
113-
message(FATAL_ERROR "C++17 support is only available for gcc version >= 7.2")
114-
endif(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 7.2)
115-
set(COMPILER_FLAGS "-std=c++17 ${COMPILER_FLAGS}")
116-
else(enable-cxx-17)
117-
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.7)
118-
message(FATAL_ERROR "C++11 support is only available for gcc version >= 4.7")
119-
endif(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.7)
120-
set(COMPILER_CXXFLAGS "${COMPILER_CXXFLAGS} -std=c++11")
121-
endif(enable-cxx-17)
122-
123110
# basic C support
124111
set(COMPILER_C_WARNINGS "-Wall -W -pedantic")
125112

cmake/modules/intel.cmake

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
set(COMPILER_CXXFLAGS "${COMPILER_CXXFLAGS} -std=c++11")
2-
31
tfel_enable_cxx_compiler_flag(COMPILER_WARNINGS "Wall")
42
# 383 : value copied to temporary, reference to temporary used
53
# 981 : operands are evaluated in unspecified order

cmake/modules/pathscale.cmake

-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,3 @@ if(HAVE_FORTRAN)
2424
message(FATAL_ERROR "unsupported fortran compiler ${CMAKE_Fortran_COMPILER_NAME}")
2525
endif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "PathScale")
2626
endif(HAVE_FORTRAN)
27-
28-
set(COMPILER_CXXFLAGS "${COMPILER_CXXFLAGS} -std=c++11")

cmake/modules/pgi.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ if(NOT enable-fast-math)
33
tfel_enable_cxx_compiler_flag(OPTIMISATION_FLAGS "Kieee")
44
endif(NOT enable-fast-math)
55

6-
set(COMPILER_CXXFLAGS "${COMPILER_CXXFLAGS} -std=c++11")
76
set(OPTIMISATION_FLAGS "-DNO_RUNTIME_CHECK_BOUNDS ${OPTIMISATION_FLAGS}")
87
if((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "Release"))
98
set(OPTIMISATION_FLAGS "-Minline -Mipa -DNDEBUG ${OPTIMISATION_FLAGS}")

cmake/modules/tfel.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ IF(TFEL_CONFIG AND MFRONT AND MFRONT_QUERY)
5252
LIST(GET TFEL_VERSION_FULL 1 TFEL_VERSION)
5353

5454
if(NOT TFEL_CXX_STANDARD_AVAILABLE EQUAL 0)
55-
set(TFEL_CXX_STANDARD 11)
55+
set(TFEL_CXX_STANDARD 17)
5656
endif(NOT TFEL_CXX_STANDARD_AVAILABLE EQUAL 0)
5757

5858
EXECUTE_PROCESS(COMMAND ${TFEL_CONFIG} "--python-version"

0 commit comments

Comments
 (0)