]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: Break everything (tm)
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 1 Feb 2014 21:53:31 +0000 (21:53 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 1 Feb 2014 21:53:31 +0000 (21:53 +0000)
 - Provide a quick sanity check to test the final link interface.

git-svn-id: https://svn.dealii.org/trunk@32370 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CMakeLists.txt
deal.II/cmake/setup_compiler_flags.cmake
deal.II/cmake/setup_finalize.cmake
deal.II/cmake/setup_sanity_checks.cmake [new file with mode: 0644]
deal.II/cmake/setup_write_config.cmake
deal.II/doc/news/changes.h

index ad2a8cacd4ed2736d765fdf6cd6a5d9de819aa83..f43d12740c32b16633ae0053d87a14358de1453f 100644 (file)
@@ -124,6 +124,7 @@ ENDFOREACH()
 INCLUDE(setup_custom_targets)
 INCLUDE(setup_finalize)
 INCLUDE(setup_write_config)
+INCLUDE(setup_sanity_checks)
 
 
 ########################################################################
index d8eb42447c764bd98f3f0d76be0c11405581dbac..0514c8f62484aeb307ba1c9601699bcec8e67ca1 100644 (file)
 # Check the user provided CXX flags:
 #
 
-IF( NOT "${DEAL_II_CXX_FLAGS_SAVED}" STREQUAL "${CACHED_DEAL_II_CXX_FLAGS_SAVED}"
-    OR NOT "${DEAL_II_LINKER_FLAGS_SAVED}" STREQUAL "${CACHED_DEAL_II_LINKER_FLAGS_SAVED}")
+IF(NOT "${DEAL_II_CXX_FLAGS_SAVED}" STREQUAL "${CACHED_DEAL_II_CXX_FLAGS_SAVED}"
+   OR NOT "${DEAL_II_LINKER_FLAGS_SAVED}" STREQUAL "${CACHED_DEAL_II_LINKER_FLAGS_SAVED}")
   MESSAGE(STATUS "")
   # Rerun this test if cxx flags changed:
   UNSET(DEAL_II_HAVE_USABLE_CXX_FLAGS CACHE)
+ELSE()
+  SET(DEAL_II_HAVE_USABLE_CXX_FLAGS TRUE CACHE INTERNAL "")
 ENDIF()
 SET(CACHED_DEAL_II_CXX_FLAGS_SAVED "${DEAL_II_CXX_FLAGS_SAVED}" CACHE INTERNAL "" FORCE)
 SET(CACHED_DEAL_II_LINKER_FLAGS_SAVED "${DEAL_II_LINKER_FLAGS_SAVED}" CACHE INTERNAL "" FORCE)
index e304e24f526c0581ec4d7e1086a2451227146027..1bf76c12e8f9423ec4dd456f37a8aa12d9be3225 100644 (file)
@@ -1,7 +1,7 @@
 ## ---------------------------------------------------------------------
 ## $Id$
 ##
-## Copyright (C) 2012 - 2013 by the deal.II authors
+## Copyright (C) 2012 - 2014 by the deal.II authors
 ##
 ## This file is part of the deal.II library.
 ##
diff --git a/deal.II/cmake/setup_sanity_checks.cmake b/deal.II/cmake/setup_sanity_checks.cmake
new file mode 100644 (file)
index 0000000..f8091b7
--- /dev/null
@@ -0,0 +1,72 @@
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2014 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.
+##
+## ---------------------------------------------------------------------
+
+
+########################################################################
+#                                                                      #
+#                            Sanity checks:                            #
+#                                                                      #
+########################################################################
+
+#
+# A quick test whether we're able to successfully link with the given
+# compiler and linker flags and the given library link interface:
+#
+
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Sanity checks.")
+
+FOREACH(_build ${DEAL_II_BUILD_TYPES})
+
+  FOREACH(_var
+    CXX_FLAGS CXX_FLAGS_${_build}
+    LINKER_FLAGS LINKER_FLAGS_${_build}
+    LIBRARIES LIBRARIES_${_build}
+    )
+    IF(NOT "${DEAL_II_${_var}}" STREQUAL "${CACHED_DEAL_II_${_var}_${_build}}")
+      UNSET(DEAL_II_SANITY_CHECK_${_build} CACHE)
+      SET(CACHED_DEAL_II_${_var}_${_build} "${DEAL_II_${_var}}" CACHE INTERNAL "" FORCE)
+    ENDIF()
+  ENDFOREACH()
+
+  RESET_CMAKE_REQUIRED()
+  ADD_FLAGS(CMAKE_REQUIRED_FLAGS
+    "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}"
+    )
+  LIST(APPEND CMAKE_REQUIRED_LIBRARIES
+    "${DEAL_II_LINKER_FLAGS} ${DEAL_II_CXX_LINKER_${_build}}"
+    )
+  LIST(APPEND CMAKE_REQUIRED_LIBRARIES
+    ${DEAL_II_LIBRARIES}
+    ${DEAL_II_LIBRARIES_${_build}}
+    )
+  CHECK_CXX_SOURCE_COMPILES("int main(){ return 0; }"
+    DEAL_II_SANITY_CHECK_${_build}
+    )
+  RESET_CMAKE_REQUIRED()
+
+  IF(NOT DEAL_II_SANITY_CHECK_${_build})
+    UNSET(DEAL_II_SANITY_CHECK_${_build} CACHE)
+    MESSAGE(FATAL_ERROR "
+  Configuration error: Cannot compile and link with the current set of
+  compiler flags, linker flags and libraries!
+
+  Please check the test output given at the end of
+  CMakeFiles/CMakeError.log and consult detailed.log for the current
+  configuration.\n\n"
+    )
+  ENDIF()
+ENDFOREACH()
index ab2354063140d7255eff6dbf339f3c48927769a8..1afca5ff200c8780d04d343661f0e20799d92e4b 100644 (file)
@@ -1,7 +1,7 @@
 ## ---------------------------------------------------------------------
 ## $Id$
 ##
-## Copyright (C) 2012 - 2013 by the deal.II authors
+## Copyright (C) 2014 by the deal.II authors
 ##
 ## This file is part of the deal.II library.
 ##
index a767e1aa5d3f37cc68568be80da04e43f7deb3f7..c09702f038916b5b4e85d400b3a91977a84fb7a3 100644 (file)
@@ -124,6 +124,12 @@ inconvenience this causes.
 <h3>Specific improvements</h3>
 
 <ol>
+  <li>Added: A sanity check for the full link interface at configure time.
+  Hopefully this prevents some people from compiling the whole library just
+  to hit a link error.
+  <br>
+  (Matthias Maier, 2014/02/01)
+
   <li>Fixed: The build system does no longer record full paths to system
   libraries but uses the appropriate short names instead.
   <br>

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.