]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Cleanup: Remove obsolete macro, unify naming of internal macros
authorMatthias Maier <tamiko@kyomu.43-1.org>
Fri, 24 Jan 2014 11:25:42 +0000 (11:25 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Fri, 24 Jan 2014 11:25:42 +0000 (11:25 +0000)
git-svn-id: https://svn.dealii.org/trunk@32294 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/checks/check_01_cxx_features.cmake
deal.II/cmake/checks/check_03_compiler_bugs.cmake
deal.II/cmake/macros/macro_pop_test_flag.cmake [deleted file]
deal.II/cmake/macros/macro_push_cmake_required.cmake [moved from deal.II/cmake/macros/macro_push_test_flag.cmake with 93% similarity]
deal.II/cmake/macros/macro_reset_cmake_required.cmake
deal.II/cmake/modules/FindTRILINOS.cmake
deal.II/cmake/setup_cached_variables.cmake
deal.II/doc/developers/cmake-internals.html

index fa1540fae49690e04f201b3208af77f858588f91..8c8759fd7692610b4ecc1461c7b248bafd56dd00 100644 (file)
@@ -51,7 +51,7 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11)
 
   # Set CMAKE_REQUIRED_FLAGS for the unit tests
   MESSAGE(STATUS "Using C++11 flag \"${DEAL_II_CXX11_FLAG}\"")
-  PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}")
+  PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}")
 
   CHECK_CXX_SOURCE_COMPILES(
     "
@@ -103,7 +103,7 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11)
   # that as well.
   #
   IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
-    PUSH_TEST_FLAG("-pthread")
+    PUSH_CMAKE_REQUIRED("-pthread")
     CHECK_CXX_SOURCE_RUNS(
       "
       #include <thread>
@@ -111,7 +111,8 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11)
       int main(){ std::thread t(f,1); t.join(); return 0; }
       "
       DEAL_II_HAVE_CXX11_THREAD)
-    POP_TEST_FLAG()
+    RESET_CMAKE_REQUIRED()
+    PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}")
   ELSE()
     # Just export it ;-)
     SET(DEAL_II_HAVE_CXX11_THREAD TRUE CACHE BOOL "")
@@ -146,7 +147,7 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11)
   #
   # On Mac OS-X 10.9 with recent gcc compilers in C++11 mode linking to
   # some standard C library functions, notably toupper and tolower, fail
-  # due to unresolved references to this functions.
+  # due to unresolved references to these functions.
   #
   # Thanks to Denis Davydov for the testcase.
   #
@@ -252,7 +253,8 @@ IF(DEAL_II_WITH_CXX11 AND NOT DEAL_II_HAVE_CXX11)
     "    -DDEAL_II_WITH_CXX11=FALSE,\n"
     "or use a different compiler, instead. (If the compiler flag for C++11 "
     "support differs from \"-std=c++0x\" or \"-std=c++11\", a suitable "
-    "compiler flag has to be specified manually.\n\n"
+    "compiler flag has to be specified manually via\n"
+    "    -DDEAL_II_CXX11_FLAG="..."\n\n"
     )
 ENDIF()
 
@@ -264,14 +266,14 @@ IF(DEAL_II_WITH_CXX11)
   ADD_FLAGS(DEAL_II_CXX_FLAGS "${DEAL_II_CXX11_FLAG}")
   MESSAGE(STATUS "DEAL_II_WITH_CXX11 successfully set up")
 
-  PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}")
+  PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}")
   CHECK_CXX_SOURCE_COMPILES(
     "
     #include <type_traits>
     int main(){ std::is_trivially_copyable<int> bob; }
     "
     DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE)
-  POP_TEST_FLAG()
+  RESET_CMAKE_REQUIRED()
 ELSE()
   MESSAGE(STATUS "DEAL_II_WITH_CXX11 disabled")
 ENDIF()
index 364bad027e4793b31b893db49b8f191cc4d9c46d..c913deb19c0d46b2ac1054da579106062e3cd3c3 100644 (file)
@@ -29,8 +29,8 @@
 #
 # - Wolfgang Bangerth, Matthias Maier, rewritten 2012
 #
-PUSH_TEST_FLAG("-Wreturn-type")
-PUSH_TEST_FLAG("-Werror")
+PUSH_CMAKE_REQUIRED("-Wreturn-type")
+PUSH_CMAKE_REQUIRED("-Werror")
 CHECK_CXX_COMPILER_BUG(
   "
   const double foo() { return 1.; }
@@ -38,8 +38,7 @@ CHECK_CXX_COMPILER_BUG(
   "
   DEAL_II_WRETURN_TYPE_CONST_QUALIFIER_BUG
   )
-POP_TEST_FLAG()
-POP_TEST_FLAG()
+RESET_CMAKE_REQUIRED()
 
 IF(DEAL_II_WRETURN_TYPE_CONST_QUALIFIER_BUG)
   ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS -Wno-return-type)
diff --git a/deal.II/cmake/macros/macro_pop_test_flag.cmake b/deal.II/cmake/macros/macro_pop_test_flag.cmake
deleted file mode 100644 (file)
index 045fe43..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-## ---------------------------------------------------------------------
-## $Id$
-##
-## Copyright (C) 2012 - 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 used in the platform checks to remove the right most flag in
-# CMAKE_REQUIRED_FLAGS
-#
-# We assume that the flags in CMAKE_REQUIRED_FLAGS are space separated
-#
-# Usage:
-#     POP_TEST_FLAG()
-#
-
-MACRO(POP_TEST_FLAG)
-  SET(CMAKE_REQUIRED_FLAGS " ${CMAKE_REQUIRED_FLAGS}")
-  STRING(REGEX REPLACE " [^ ]+$" ""
-    CMAKE_REQUIRED_FLAGS
-    "${CMAKE_REQUIRED_FLAGS}"
-    )
-  STRING(STRIP "${CMAKE_REQUIRED_FLAGS}" CMAKE_REQUIRED_FLAGS)
-ENDMACRO()
-
similarity index 93%
rename from deal.II/cmake/macros/macro_push_test_flag.cmake
rename to deal.II/cmake/macros/macro_push_cmake_required.cmake
index 905ce92e169e0ecf52c730ab7287c02c9f878f7c..180df5981db874137d064427335f71da23348259 100644 (file)
 # CMAKE_REQUIRED_FLAGS
 #
 # Usage:
-#     PUSH_TEST_FLAG("flag")
+#     PUSH_CMAKE_REQUIRED("flag")
 #
 
-MACRO(PUSH_TEST_FLAG _flag)
+MACRO(PUSH_CMAKE_REQUIRED _flag)
 
   SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${_flag}")
   STRING(STRIP "${CMAKE_REQUIRED_FLAGS}" CMAKE_REQUIRED_FLAGS)
index 53a481878667dd8a0de7abe590e87371472a3acc..02254b27a253a69307c20a3f1bbe53fb725f7e75 100644 (file)
@@ -25,6 +25,6 @@
 MACRO(RESET_CMAKE_REQUIRED)
   SET(CMAKE_REQUIRED_FLAGS ${DEAL_II_CXX_FLAGS_SAVED})
   SET(CMAKE_REQUIRED_INCLUDES)
-  SET(CMAKE_REQUIRED_LIBRARIES)
+  SET(CMAKE_REQUIRED_LIBRARIES ${DEAL_II_LINKER_FLAGS_SAVED})
 ENDMACRO()
 
index 8857da9f824c74fad42b1acbc6f511f7fbdd6163..877e550f65487b6326f5af1d759ae5d5f3979b78 100644 (file)
@@ -183,7 +183,7 @@ IF(TRILINOS_FOUND)
   ENDIF()
 
   LIST(APPEND CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIRS})
-  PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}")
+  PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}")
 
   CHECK_CXX_SOURCE_COMPILES(
     "
@@ -196,7 +196,7 @@ IF(TRILINOS_FOUND)
   #
   # Try whether exporting HAS_C99_TR1_CMATH helps:
   #
-  PUSH_TEST_FLAG("-DHAS_C99_TR1_CMATH")
+  PUSH_CMAKE_REQUIRED("-DHAS_C99_TR1_CMATH")
   CHECK_CXX_SOURCE_COMPILES(
     "
     #include <Sacado_cmath.hpp>
index 913aba891c586602e835915950413bc261e1858a..897d36befa43b44d17d2a89f6296c9c65b9c8afc 100644 (file)
@@ -353,7 +353,7 @@ It is not possible to install into the build directory. Please set
 CMAKE_INSTALL_PREFIX to a designated install directory different than
 CMAKE_BINARY_DIR.
 (Please note that you can use deal.II directly out of a build directory
-if this is what you tried to do.)
+without the need to install it, if this is what you tried to do.)
 "
     )
 ENDIF()
index aea4a22765dd26edfe4522162a64f94ab1474ec9..3517b168bb8868ad7903d2a031a4a847f62aba40 100644 (file)
@@ -292,13 +292,13 @@ CHECK_CXX_COMPILER_FLAG(flag variable)
 </pre>
 
   <li> Necessary compiler flags can easily set in the string variable
-    <code>CMAKE_REQUIRED_FLAGS</code>. There are two small macros
-    that do this job nicely:
+    <code>CMAKE_REQUIRED_FLAGS</code>. There is a small macro that does this
+    job nicely:
 
 <pre class="cmake">
-PUSH_TEST_FLAG("-Werror")
+PUSH_CMAKE_REQUIRED("-Werror")
 CHECK_CXX_SOURCE_COMPILES(...)
-POP_TEST_FLAG()
+RESET_CMAKE_REQUIRED()
 </pre>
 
   <li> Necessary include directories and libraries necessary for

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.