From 11512bb1d0dc8b470423511398c4b54e670d8567 Mon Sep 17 00:00:00 2001 From: David Wells Date: Tue, 28 Mar 2017 12:16:18 -0400 Subject: [PATCH] Always add the user version flag. This gets around a bug where, if a user requests '-std=c++03' and is using a compiler which defaults to C++11 or newer (e.g., GCC 6) then the library is compiled with the default language flag (e.g., gnu++14) but DEAL_II_WITH_CXX11=OFF: this causes compilation errors with boost::optional. --- cmake/checks/check_01_cxx_features.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index ac17aaad07..8c3e490f80 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -406,6 +406,13 @@ IF (DEAL_II_WITH_CXX14) ELSEIF(DEAL_II_WITH_CXX11) ADD_FLAGS(DEAL_II_CXX_FLAGS "${DEAL_II_CXX_VERSION_FLAG}") MESSAGE(STATUS "DEAL_II_WITH_CXX11 successfully set up") + # + # If the user specified a flag that does not imply C++11 or C++14 (e.g., + # -std=c++03) then add it + # +ELSEIF(_user_provided_cxx_version_flag) + MESSAGE(STATUS "Using C++ version flag \"${DEAL_II_CXX_VERSION_FLAG}\"") + ADD_FLAGS(DEAL_II_CXX_FLAGS "${DEAL_II_CXX_VERSION_FLAG}") ELSE() MESSAGE(STATUS "DEAL_II_WITH_CXX14 and DEAL_II_WITH_CXX11 are both disabled") ENDIF() -- 2.39.5