diff --git a/CMakeLists.txt b/CMakeLists.txt index c0a59fa36..3b6a499c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,11 +22,18 @@ endif() option(ENABLE_CGNS "Enable the CGNS reader: requires c++14 extensions" OFF) message(STATUS "ENABLE_CGNS: ${ENABLE_CGNS}") -if(NOT ENABLE_CGNS) +option(ENABLE_OMEGA_H "Enable the Omega_h interface" OFF) +set(PUMI_USE_OMEGA_H_VERSION "10.0.0" CACHE STRING "Specify the Omega_h version PUMI should use") +message(STATUS "ENABLE_OMEGA_H: ${ENABLE_OMEGA_H}") +if(NOT ENABLE_CGNS AND NOT ENABLE_OMEGA_H) + message(STATUS "enabling cxx11") bob_set_cxx_standard(11) -else() +elseif(ENABLE_CGNS) message(STATUS "enabling cxx14") bob_set_cxx_standard(14) +elseif(ENABLE_OMEGA_H) + message(STATUS "enabling cxx17") + bob_set_cxx_standard(17) endif() # Set some default compiler flags that should always be used @@ -114,9 +121,6 @@ option(ENABLE_SIMMETRIX "Build with Simmetrix support" OFF) message(STATUS "ENABLE_SIMMETRIX: ${ENABLE_SIMMETRIX}") option(ENABLE_CAPSTONE "Build with Capstone support" OFF) message(STATUS "ENABLE_CAPSTONE: ${ENABLE_CAPSTONE}") -option(ENABLE_OMEGA_H "Enable the Omega_h interface" OFF) -option(PUMI_USE_OMEGA_H_VERSION "Specify the Omega_h version PUMI should use" 10.0.0) -message(STATUS "ENABLE_OMEGA_H: ${ENABLE_OMEGA_H}") if(ENABLE_SIMMETRIX) add_definitions(-DHAVE_SIMMETRIX) @@ -146,6 +150,8 @@ if(ENABLE_CAPSTONE) endif() if(ENABLE_OMEGA_H) + bob_cxx17_flags() + bob_set_cxx_standard(17) # find the omega_h library set(SCOREC_USE_Omega_h_DEFAULT ${ENABLE_OMEGA_H}) set(Omega_h_REQUIRED_VERSION ${PUMI_USE_OMEGA_H_VERSION}) diff --git a/cmake/bob.cmake b/cmake/bob.cmake index 4bf5dcce9..2b2fb8934 100644 --- a/cmake/bob.cmake +++ b/cmake/bob.cmake @@ -117,6 +117,17 @@ function(bob_cxx14_flags) set(CMAKE_CXX_FLAGS "${FLAGS}" PARENT_SCOPE) endfunction(bob_cxx14_flags) +function(bob_cxx17_flags) + set(FLAGS "${CMAKE_CXX_FLAGS}") + set(FLAGS "${FLAGS} -Wall -Wextra -Wpedantic -Werror -Wno-extra-semi -Werror=unused-parameter -Wno-error=deprecated-declarations") + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if (${PROJECT_NAME}_CXX_WARNINGS) + set(FLAGS "${FLAGS} -Wno-c++98-compat-pedantic -Wno-c++98-compat") + endif() + endif() + set(CMAKE_CXX_FLAGS "${FLAGS}" PARENT_SCOPE) +endfunction(bob_cxx17_flags) + function(bob_end_cxx_flags) set(${PROJECT_NAME}_CXX_FLAGS "" CACHE STRING "Override all C++ compiler flags") set(${PROJECT_NAME}_EXTRA_CXX_FLAGS "" CACHE STRING "Extra C++ compiler flags") diff --git a/omega_h/CMakeLists.txt b/omega_h/CMakeLists.txt index 750fa0538..856e2656b 100644 --- a/omega_h/CMakeLists.txt +++ b/omega_h/CMakeLists.txt @@ -17,11 +17,6 @@ set(HEADERS # Add the apf_omega_h library add_library(apf_omega_h ${SOURCES}) -if(ENABLE_CGNS) - target_compile_options(apf_omega_h PUBLIC "-std=c++14") -else() - target_compile_options(apf_omega_h PUBLIC "-std=c++11") -endif() # Include directories target_include_directories(apf_omega_h INTERFACE