From: maier Date: Wed, 27 Mar 2013 17:37:14 +0000 (+0000) Subject: CMake: Bugfix X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0334c656aa7cda5585bba6495fbb9d97f9ddb873;p=dealii-svn.git CMake: Bugfix git-svn-id: https://svn.dealii.org/trunk@29082 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/macros/macro_enable_if_links.cmake b/deal.II/cmake/macros/macro_enable_if_links.cmake index c12936568c..e2d2a2b9e3 100644 --- a/deal.II/cmake/macros/macro_enable_if_links.cmake +++ b/deal.II/cmake/macros/macro_enable_if_links.cmake @@ -27,12 +27,14 @@ MACRO(ENABLE_IF_LINKS _variable _flag) STRING(REGEX REPLACE "^-" "" _flag_name "${_flag_stripped}") STRING(REPLACE "," "" _flag_name "${_flag_name}") STRING(REPLACE "--" "__" _flag_name "${_flag_name}") - ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${_flag_stripped}") + SET(_backup ${CMAKE_REQUIRED_LIBRARIES}) + SET(CMAKE_REQUIRED_LIBRARIES "${_flag_stripped}") CHECK_CXX_COMPILER_FLAG( "" DEAL_II_HAVE_FLAG_${_flag_name} ) - STRIP_FLAG(CMAKE_REQUIRED_FLAGS "${_flag_stripped}") + SET(CMAKE_REQUIRED_LIBRARIES ${_backup}) + IF(DEAL_II_HAVE_FLAG_${_flag_name}) SET(${_variable} "${${_variable}} ${_flag_stripped}") STRING(STRIP "${${_variable}}" ${_variable}) diff --git a/deal.II/cmake/setup_compiler_flags_gnu.cmake b/deal.II/cmake/setup_compiler_flags_gnu.cmake index 365e3d5221..ae808667e3 100644 --- a/deal.II/cmake/setup_compiler_flags_gnu.cmake +++ b/deal.II/cmake/setup_compiler_flags_gnu.cmake @@ -58,8 +58,7 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") # Check whether the -as-needed flag is available. If so set it to link # the deal.II library with it. # -# TODO: Disabled until ENABLE_IF_LINKS is properly implemented -#ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") +ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") # diff --git a/deal.II/cmake/setup_compiler_flags_intel.cmake b/deal.II/cmake/setup_compiler_flags_intel.cmake index 1edd5a0ce3..ac9808b055 100644 --- a/deal.II/cmake/setup_compiler_flags_intel.cmake +++ b/deal.II/cmake/setup_compiler_flags_intel.cmake @@ -42,8 +42,7 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") # Check whether the -as-needed flag is available. If so set it to link # the deal.II library with it. # -# TODO: Disabled until ENABLE_IF_LINKS is properly implemented -#ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") +ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") # # Set ansi mode: