]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a small test routine
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Sep 2012 08:37:01 +0000 (08:37 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Sep 2012 08:37:01 +0000 (08:37 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26370 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/contrib/cmake/check/check_for_compiler_features.cmake
deal.II/contrib/cmake/macros/macro_check_cxx_compiler_bug.cmake [new file with mode: 0644]

index d5c2fab607e5e6eec3fbd0027108a4e2fd8f3098..63e8dcb03e0e6ec2e91a13f42773270785c7d01f 100644 (file)
@@ -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 <vector>
   template <typename T> void f(T) {}
@@ -21,11 +20,7 @@ CHECK_CXX_SOURCE_COMPILES(
   template void f(std::vector<int>::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 (file)
index 0000000..b920522
--- /dev/null
@@ -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()

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.