From 2e326732abcb8f9df6c830416eb095396bbef647 Mon Sep 17 00:00:00 2001 From: April Novak Date: Mon, 25 Apr 2022 12:13:20 -0500 Subject: [PATCH 1/2] Allow control of C++ standard. Refs #2039 --- CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cf5ce6d8d..28f917956a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -454,11 +454,9 @@ target_compile_options(openmc PRIVATE ${cxxflags}) target_include_directories(openmc PRIVATE ${CMAKE_BINARY_DIR}/include) target_link_libraries(openmc libopenmc) -# Ensure C++14 standard is used. Starting with CMake 3.8, another way this could -# be done is using the cxx_std_14 compiler feature. -set_target_properties( - openmc libopenmc - PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF) +# Ensure C++14 standard is used +target_compile_features(openmc PUBLIC cxx_std_14) +target_compile_features(libopenmc PUBLIC cxx_std_14) #=============================================================================== # Python package From 575a678207712e04e940c89f89431da4cc02120a Mon Sep 17 00:00:00 2001 From: April Novak Date: Tue, 26 Apr 2022 11:06:28 -0500 Subject: [PATCH 2/2] Adjust C++ standard for Moab test. Refs #2039 --- tests/regression_tests/external_moab/test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/regression_tests/external_moab/test.py b/tests/regression_tests/external_moab/test.py index 47e3ef80ed..b9d3072392 100644 --- a/tests/regression_tests/external_moab/test.py +++ b/tests/regression_tests/external_moab/test.py @@ -37,8 +37,7 @@ def cpp_driver(request): add_executable(main main.cpp) find_package(OpenMC REQUIRED HINTS {}) target_link_libraries(main OpenMC::libopenmc) - set_target_properties(main PROPERTIES CXX_STANDARD - 14 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO) + target_compile_features(main PUBLIC cxx_std_14) set(CMAKE_CXX_FLAGS "-pedantic-errors") add_compile_definitions(DAGMC=1) """.format(openmc_dir)))