From c6dbcf7d00c7ff4b9bf706d581a44378cf1a33bd Mon Sep 17 00:00:00 2001 From: maier Date: Fri, 14 Sep 2012 08:37:01 +0000 Subject: [PATCH] Add a small test routine git-svn-id: https://svn.dealii.org/branches/branch_cmake@26370 0785d39b-7218-0410-832d-ea1e28bc413d --- .../check/check_for_compiler_features.cmake | 9 ++------ .../macros/macro_check_cxx_compiler_bug.cmake | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 deal.II/contrib/cmake/macros/macro_check_cxx_compiler_bug.cmake diff --git a/deal.II/contrib/cmake/check/check_for_compiler_features.cmake b/deal.II/contrib/cmake/check/check_for_compiler_features.cmake index d5c2fab607..63e8dcb03e 100644 --- a/deal.II/contrib/cmake/check/check_for_compiler_features.cmake +++ b/deal.II/contrib/cmake/check/check_for_compiler_features.cmake @@ -12,8 +12,7 @@ INCLUDE(CheckCXXSourceRuns) # # Check whether the std::vector::iterator is just a plain pointer # -# TODO: Get rid of this negation! -CHECK_CXX_SOURCE_COMPILES( +CHECK_CXX_COMPILER_BUG( # Yes. It is not a bug. But the logic is the same. " #include template void f(T) {} @@ -21,11 +20,7 @@ CHECK_CXX_SOURCE_COMPILES( template void f(std::vector::iterator); int main(){return 0;} " - DEAL_II_VECTOR_ITERATOR_IS_NOT_POINTER) - -IF(NOT DEAL_II_VECTOR_ITERATOR_IS_NOT_POINTER) - SET(DEAL_II_VECTOR_ITERATOR_IS_POINTER TRUE) -ENDIF() + DEAL_II_VECTOR_ITERATOR_IS_POINTER) diff --git a/deal.II/contrib/cmake/macros/macro_check_cxx_compiler_bug.cmake b/deal.II/contrib/cmake/macros/macro_check_cxx_compiler_bug.cmake new file mode 100644 index 0000000000..b920522f20 --- /dev/null +++ b/deal.II/contrib/cmake/macros/macro_check_cxx_compiler_bug.cmake @@ -0,0 +1,21 @@ +INCLUDE(CheckCXXSourceCompiles) + +MACRO(CHECK_CXX_COMPILER_BUG source var) + + # + # Check for a compiler bug, i.e. if source does not compile, define var + # This just inverts the logic of CHECK_CXX_SOURCE_COMPILES. + # + + CHECK_CXX_SOURCE_COMPILES( + "${source}" + ${var}_OK) + + IF(${var}_OK) + MESSAGE(STATUS "Test successful, do not define ${var}") + ELSE() + MESSAGE(STATUS "Test unsuccessful, definig ${var}") + SET(${var} 1) + ENDIF() + +ENDMACRO() -- 2.39.5