Moved settings of CMake_STANDARD stuff to OPMInit.cmake

That makes it usable from *prereqs and helps preventing
multiple -std=c++xx options when compiling (at least for
pybind11)
This commit is contained in:
Markus Blatt
2021-03-15 21:50:28 +01:00
parent 55bdaaa9f9
commit 77050e5042
2 changed files with 12 additions and 10 deletions

View File

@@ -135,6 +135,18 @@ if (NOT USE_MPI)
set (CMAKE_DISABLE_FIND_PACKAGE_MPI TRUE)
endif ()
# Compiler standard version needs to be requested here as prereqs is included
# before OpmLibMain and some tests need/use CXX_STANDARD_VERSION (e.g. pybind11)
# Languages and global compiler settings
if(CMAKE_VERSION VERSION_LESS 3.8)
message(WARNING "CMake version does not support c++17, guessing -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
else()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
# quadmath must be explicitly enabled
# This needs to be in OpmInit as prereqs is called before OpmLibMain is included.
option (USE_QUADMATH "Use high precision floating point library (slow)" OFF)