MACRO(ENABLE_IF_LINKS _variable _flag)
STRING(STRIP "${_flag}" _flag_stripped)
+
IF(NOT "${_flag_stripped}" STREQUAL "")
STRING(REGEX REPLACE "^-" "" _flag_name "${_flag_stripped}")
- STRING(REPLACE "," "" _flag_name "${_flag_name}")
- STRING(REPLACE "-" "_" _flag_name "${_flag_name}")
- STRING(REPLACE "+" "_" _flag_name "${_flag_name}")
+ STRING(REGEX REPLACE "\[-+,\]" "_" _flag_name "${_flag_name}")
+
SET(_backup ${CMAKE_REQUIRED_LIBRARIES})
LIST(APPEND CMAKE_REQUIRED_LIBRARIES "${_flag_stripped}")
- CHECK_CXX_COMPILER_FLAG(
- ""
- DEAL_II_HAVE_FLAG_${_flag_name}
- )
+ CHECK_CXX_SOURCE_COMPILES("int main(){}" DEAL_II_HAVE_LINKER_FLAG_${_flag_name})
SET(CMAKE_REQUIRED_LIBRARIES ${_backup})
- IF(DEAL_II_HAVE_FLAG_${_flag_name})
+ IF(DEAL_II_HAVE_LINKER_FLAG_${_flag_name})
SET(${_variable} "${${_variable}} ${_flag_stripped}")
STRING(STRIP "${${_variable}}" ${_variable})
ENDIF()