]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: And guard the last to occurences of a C compiler as well
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 30 Jul 2013 09:22:03 +0000 (09:22 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 30 Jul 2013 09:22:03 +0000 (09:22 +0000)
git-svn-id: https://svn.dealii.org/trunk@30184 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/checks/check_01_cpu_features.cmake
deal.II/cmake/configure/configure_1_lapack.cmake
deal.II/cmake/configure/configure_1_threads.cmake
deal.II/cmake/macros/macro_clear_cmake_required.cmake [new file with mode: 0644]

index d83f4494c836d364323eae49e4fe852a8f459431..9639b89497285aedbc9584f547537832a614f1f2 100644 (file)
 # Determine the Endianess of the platform:
 #
 IF(CMAKE_C_COMPILER_WORKS)
-  SET(CMAKE_REQUIRED_FLAGS)
-  SET(CMAKE_REQUIRED_INCLUDES)
-  SET(CMAKE_REQUIRED_LIBRARIES)
-
   INCLUDE(TestBigEndian)
-  TEST_BIG_ENDIAN(DEAL_II_WORDS_BIGENDIAN)
 
+  CLEAR_CMAKE_REQUIRED()
+  TEST_BIG_ENDIAN(DEAL_II_WORDS_BIGENDIAN)
   RESET_CMAKE_REQUIRED()
 ELSE()
   MESSAGE(STATUS
index 85e063eae08bb7a693e8ca05fb53aca0bf9a6046..234d4855680b3f3c184450fd7dd41c981fba614b 100644 (file)
@@ -59,7 +59,6 @@ MACRO(FEATURE_LAPACK_FIND_EXTERNAL var)
     # Do this unconditionally for the most common case:
     # TODO: Non-GNU setups...
     #
-    #
     # Switch the library preference back to prefer dynamic libraries if
     # DEAL_II_PREFER_STATIC_LIBS=TRUE but DEAL_II_STATIC_EXECUTABLE=FALSE. In
     # this case system libraries should be linked dynamically.
@@ -97,8 +96,12 @@ SET(DEAL_II_LAPACK_FUNCTIONS
   )
 
 MACRO(CHECK_FOR_LAPACK_FUNCTIONS)
-  LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
-  ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${LAPACK_LINKER_FLAGS}")
+  #
+  # Clear the test flags because the following test will use a C compiler
+  #
+  CLEAR_CMAKE_REQUIRED()
+  SET(CMAKE_REQUIRED_FLAGS "${LAPACK_LINKER_FLAGS}")
+  SET(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
   #
   # Push -pthread as well:
   #
index a21ed1eeb1821d8e95a9bdc2c8f4cc2646443099..d43fd3ea49d29f30041d3927e594672fca95be35 100644 (file)
@@ -36,7 +36,15 @@ MACRO(SETUP_THREADING)
     # this case system libraries should be linked dynamically.
     #
     SWITCH_LIBRARY_PREFERENCE()
+
+    #
+    # Clear the test flags because FindThreads.cmake will use a C compiler:
+    #
+    CLEAR_CMAKE_REQUIRED()
+
     FIND_PACKAGE(Threads)
+
+    RESET_CMAKE_REQUIRED()
     SWITCH_LIBRARY_PREFERENCE()
 
   ELSE()
diff --git a/deal.II/cmake/macros/macro_clear_cmake_required.cmake b/deal.II/cmake/macros/macro_clear_cmake_required.cmake
new file mode 100644 (file)
index 0000000..186004f
--- /dev/null
@@ -0,0 +1,29 @@
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2013 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+#
+# A small macro to clear the CMAKE_REQUIRED_* variables.
+#
+# Usage:
+#     CLEAR_CMAKE_REQUIRED_FLAGS
+#
+
+MACRO(CLEAR_CMAKE_REQUIRED)
+  SET(CMAKE_REQUIRED_FLAGS)
+  SET(CMAKE_REQUIRED_INCLUDES)
+  SET(CMAKE_REQUIRED_LIBRARIES)
+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.