From 79bb9c8e114aa6d8934407b48cb5a1be3a6531df Mon Sep 17 00:00:00 2001 From: maier Date: Mon, 11 Mar 2013 18:16:02 +0000 Subject: [PATCH] CMake: Bugfixes, be more robust in two macros git-svn-id: https://svn.dealii.org/trunk@28856 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/macros/macro_add_flags.cmake | 4 +++- .../cmake/macros/macro_enable_if_supported.cmake | 16 +++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/deal.II/cmake/macros/macro_add_flags.cmake b/deal.II/cmake/macros/macro_add_flags.cmake index b3d15f1b14..2bcddaa0a8 100644 --- a/deal.II/cmake/macros/macro_add_flags.cmake +++ b/deal.II/cmake/macros/macro_add_flags.cmake @@ -21,6 +21,8 @@ # MACRO(ADD_FLAGS _variable _flags) - SET(${_variable} "${${_variable}} ${_flags}") + IF(NOT "${_flags}" STREQUAL "") + SET(${_variable} "${${_variable}} ${_flags}") + ENDIF() ENDMACRO() diff --git a/deal.II/cmake/macros/macro_enable_if_supported.cmake b/deal.II/cmake/macros/macro_enable_if_supported.cmake index 817018746c..d843de50da 100644 --- a/deal.II/cmake/macros/macro_enable_if_supported.cmake +++ b/deal.II/cmake/macros/macro_enable_if_supported.cmake @@ -21,13 +21,15 @@ # MACRO(ENABLE_IF_SUPPORTED _variable _flag) - STRING(REGEX REPLACE "^-" "" _flag_name "${_flag}") - CHECK_CXX_COMPILER_FLAG( - "${_flag}" - DEAL_II_HAVE_FLAG_${_flag_name} - ) - IF(DEAL_II_HAVE_FLAG_${_flag_name}) - SET(${_variable} "${${_variable}} ${_flag}") + IF(NOT "${_flag}" STREQUAL "") + STRING(REGEX REPLACE "^-" "" _flag_name "${_flag}") + CHECK_CXX_COMPILER_FLAG( + "${_flag}" + DEAL_II_HAVE_FLAG_${_flag_name} + ) + IF(DEAL_II_HAVE_FLAG_${_flag_name}) + SET(${_variable} "${${_variable}} ${_flag}") + ENDIF() ENDIF() ENDMACRO() -- 2.39.5