From: maier Date: Tue, 30 Jul 2013 09:22:03 +0000 (+0000) Subject: CMake: And guard the last to occurences of a C compiler as well X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e95414ce19b848a8164ff4c4e1e52b23efc8ca5;p=dealii-svn.git CMake: And guard the last to occurences of a C compiler as well git-svn-id: https://svn.dealii.org/trunk@30184 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/checks/check_01_cpu_features.cmake b/deal.II/cmake/checks/check_01_cpu_features.cmake index d83f4494c8..9639b89497 100644 --- a/deal.II/cmake/checks/check_01_cpu_features.cmake +++ b/deal.II/cmake/checks/check_01_cpu_features.cmake @@ -40,13 +40,10 @@ # 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 diff --git a/deal.II/cmake/configure/configure_1_lapack.cmake b/deal.II/cmake/configure/configure_1_lapack.cmake index 85e063eae0..234d485568 100644 --- a/deal.II/cmake/configure/configure_1_lapack.cmake +++ b/deal.II/cmake/configure/configure_1_lapack.cmake @@ -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: # diff --git a/deal.II/cmake/configure/configure_1_threads.cmake b/deal.II/cmake/configure/configure_1_threads.cmake index a21ed1eeb1..d43fd3ea49 100644 --- a/deal.II/cmake/configure/configure_1_threads.cmake +++ b/deal.II/cmake/configure/configure_1_threads.cmake @@ -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 index 0000000000..186004f5d0 --- /dev/null +++ b/deal.II/cmake/macros/macro_clear_cmake_required.cmake @@ -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() +