From: David Wells Date: Tue, 28 Mar 2017 16:16:18 +0000 (-0400) Subject: Always add the user version flag. X-Git-Tag: v8.5.0-rc1^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4129%2Fhead;p=dealii.git 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. --- 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()