diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 7da06e0402d6209a46cbedb51ce0317574e5252c..b857dc4dc69a8b3af600362ca10ce9a8e9fb8d69 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -17,7 +17,6 @@ install(FILES DuneAddPybind11Module.cmake DuneCMakeCompat.cmake DuneCommonMacros.cmake - DuneCxaDemangle.cmake DuneDoc.cmake DuneDoxygen.cmake DuneEnableAllPackages.cmake diff --git a/cmake/modules/DuneCxaDemangle.cmake b/cmake/modules/DuneCxaDemangle.cmake deleted file mode 100644 index 08d557c17e8c2e8065b21a69cf6a01d8b842a7ae..0000000000000000000000000000000000000000 --- a/cmake/modules/DuneCxaDemangle.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# This module checks whether the compiler supports the -# abi::__cxa_demangle function required to -# make the type names returned by typeid() human-readable -# -# It sets the variable :code:`HAVE_CXA_DEMANGLE` with the result. -# -include_guard(GLOBAL) - -include(CheckCXXSourceCompiles) - -CHECK_CXX_SOURCE_COMPILES("#include <typeinfo> -#include <cxxabi.h> -int main(void){ - int foobar = 0; - const char *foo = typeid(foobar).name(); - int status; - char *demangled = abi::__cxa_demangle( foo, 0, 0, &status ); -}" HAVE_CXA_DEMANGLE) diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake index 162848014ea16397bfd84d9202c42fcca66d628a..bc4516a23706bd4f89021b1682d2bc81d1cc4e3d 100644 --- a/cmake/modules/DuneMacros.cmake +++ b/cmake/modules/DuneMacros.cmake @@ -684,7 +684,6 @@ macro(dune_project) # check for C++ features, set compiler flags for C++14 or C++11 mode include(CheckCXXFeatures) - include(DuneCxaDemangle) # set include path and link path for the current project. include_directories("${CMAKE_BINARY_DIR}") diff --git a/config.h.cmake b/config.h.cmake index af0c478eb671cad978e2715472aee2318832d3db..dd10263a16869590d829288e9acefa067ecac97e 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -41,9 +41,6 @@ /* Define if you have a BLAS library. */ #cmakedefine HAVE_BLAS 1 -/* does the compiler support abi::__cxa_demangle */ -#cmakedefine HAVE_CXA_DEMANGLE 1 - /* Define if you have LAPACK library. */ #cmakedefine HAVE_LAPACK 1 diff --git a/dune/common/classname.hh b/dune/common/classname.hh index d1ec24b718df5d1d7070bc74391ac0be215eb17a..f24e330a6c0b0c1746aba94dd355fffe6513f845 100644 --- a/dune/common/classname.hh +++ b/dune/common/classname.hh @@ -14,7 +14,8 @@ #include <typeinfo> #include <type_traits> -#if HAVE_CXA_DEMANGLE +#if __has_include(<cxxabi.h>) && !DISABLE_CXA_DEMANGLE +#define HAVE_CXA_DEMANGLE 1 #include <cxxabi.h> #endif // #if HAVE_CXA_DEMANGLE diff --git a/dune/common/test/CMakeLists.txt b/dune/common/test/CMakeLists.txt index 08927abe5646126c680f1e030a3af5cfa2248c1a..f6e652f7b375127eaea664560367064401af8a07 100644 --- a/dune/common/test/CMakeLists.txt +++ b/dune/common/test/CMakeLists.txt @@ -71,13 +71,12 @@ dune_add_test(NAME check_fvector_size_fail2 dune_add_test(NAME classnametest-demangled SOURCES classnametest.cc LINK_LIBRARIES dunecommon - CMAKE_GUARD HAVE_CXA_DEMANGLE LABELS quick) dune_add_test(NAME classnametest-fallback SOURCES classnametest.cc LINK_LIBRARIES dunecommon - COMPILE_DEFINITIONS BASICCHECK + COMPILE_DEFINITIONS DISABLE_CXA_DEMANGLE LABELS quick) dune_add_test(SOURCES concept.cc diff --git a/dune/common/test/classnametest.cc b/dune/common/test/classnametest.cc index ee60e0c450dc561dd147163f6b992096a5077803..682d8d43d42f670839fbc239f023076172da88e7 100644 --- a/dune/common/test/classnametest.cc +++ b/dune/common/test/classnametest.cc @@ -131,7 +131,7 @@ int main() checkname(t, Dune::className(Base{}), {}, R"(\bBase\b)"); std::cout << std::endl; - #if BASICCHECK + #if !HAVE_CXA_DEMANGLE // in this case we only make sure that no segfault or similar happens return 0; #else