From: Matthias Maier Date: Wed, 19 Aug 2015 21:22:29 +0000 (-0500) Subject: CMake: Fix test for clang debug compatibility with C++14 X-Git-Tag: v8.4.0-rc2~566^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbd61c0fd67b5d2f72f4444292c78a2dcfa13938;p=dealii.git CMake: Fix test for clang debug compatibility with C++14 Test for a spurios error emitted by clang in case of "deduced return types" (a C++14 feature) in combination with debug symbols. Disable C++14 support in this case because we cannot compile bundled boost. This affects clang-3.5* and older. Fixed in clang-3.6 and newer. Relates #1390 --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index 32d49236cc..974b2ccb6e 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -103,10 +103,6 @@ IF(NOT DEFINED DEAL_II_WITH_CXX14 OR DEAL_II_WITH_CXX14) MESSAGE(STATUS "Using C++ version flag \"${DEAL_II_CXX_VERSION_FLAG}\"") PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") - # Some versions of clang are feature complete but do not have debug - # information. - PUSH_CMAKE_REQUIRED("-g") - # # This test does not guarantee full C++14 support, but virtually every # compiler with some C++14 support implements this. @@ -122,10 +118,26 @@ IF(NOT DEFINED DEAL_II_WITH_CXX14 OR DEAL_II_WITH_CXX14) " DEAL_II_HAVE_CXX14_MAKE_UNIQUE) + # + # Clang-3.5* or older, bail out with a spurious error message in case + # of an undeduced auto return type. + # + PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_FLAGS_DEBUG}") + CHECK_CXX_SOURCE_COMPILES( + " + struct foo + { + auto func(); + }; + int main() {} + " + DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK) + RESET_CMAKE_REQUIRED() ENDIF() - IF(DEAL_II_HAVE_CXX14_MAKE_UNIQUE) + IF( DEAL_II_HAVE_CXX14_MAKE_UNIQUE AND + DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK ) SET(DEAL_II_HAVE_CXX14 TRUE) ELSE() IF(NOT _user_provided_cxx_version_flag)