STRIP_FLAG(DEAL_II_SHARED_LINKER_FLAGS_DEBUG "-g")
ENDIF()
+IF(CMAKE_SYSTEM_NAME MATCHES "CYGWIN")
+ #
+ # Workaround for a miscompilation and linkage issue with shared libraries
+ # under Cygwin. Replacing -O0 with -O1 helps.
+ #
+ # - Matthias Maier, 2013
+ #
+ REPLACE_FLAG(DEAL_II_CXX_FLAGS_DEBUG "-O0" "-O1")
+
+ENDIF()
#
MACRO(ADD_FLAGS _variable _flags)
- IF(NOT "${_flags}" STREQUAL "")
+ STRING(STRIP "${_flags}" _flags_stripped)
+ IF(NOT "${_flags_stripped}" STREQUAL "")
SET(${_variable} "${${_variable}} ${_flags}")
+ STRING(STRIP "${${_variable}}" ${_variable})
ENDIF()
ENDMACRO()
#
MACRO(ENABLE_IF_LINKS _variable _flag)
- STRING(REGEX REPLACE "^-" "" _flag_name "${_flag}")
+ STRING(STRIP "${_flag}" _flag_stripped)
+ STRING(REGEX REPLACE "^-" "" _flag_name "${_flag_stripped}")
- ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${_flag}")
- CHECK_CXX_SOURCE_COMPILES(
- "
- int main() { return 0; }
- "
- DEAL_II_HAVE_FLAG_${_flag_name}
- )
- STRIP_FLAG(CMAKE_REQUIRED_FLAGS "${_flag}")
- IF(DEAL_II_HAVE_FLAG_${_flag_name})
- SET(${_variable} "${${_variable}} ${_flag}")
+ IF(NOT "${_flag_stripped}" STREQUAL "")
+ ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${_flag_stripped}")
+ CHECK_CXX_SOURCE_COMPILES(
+ "
+ int main() { return 0; }
+ "
+ DEAL_II_HAVE_FLAG_${_flag_name}
+ )
+ STRIP_FLAG(CMAKE_REQUIRED_FLAGS "${_flag_stripped}")
+ IF(DEAL_II_HAVE_FLAG_${_flag_name})
+ SET(${_variable} "${${_variable}} ${_flag_stripped}")
+ STRING(STRIP "${${_variable}}" ${_variable})
+ ENDIF()
ENDIF()
ENDMACRO()
#
MACRO(ENABLE_IF_SUPPORTED _variable _flag)
- IF(NOT "${_flag}" STREQUAL "")
- STRING(REGEX REPLACE "^-" "" _flag_name "${_flag}")
+ STRING(STRIP "${_flag}" _flag_stripped)
+ IF(NOT "${_flag_stripped}" STREQUAL "")
+ STRING(REGEX REPLACE "^-" "" _flag_name "${_flag_stripped}")
CHECK_CXX_COMPILER_FLAG(
- "${_flag}"
+ "${_flag_stripped}"
DEAL_II_HAVE_FLAG_${_flag_name}
)
IF(DEAL_II_HAVE_FLAG_${_flag_name})
- SET(${_variable} "${${_variable}} ${_flag}")
+ SET(${_variable} "${${_variable}} ${_flag_stripped}")
+ STRING(STRIP "${${_variable}}" ${_variable})
ENDIF()
ENDIF()
ENDMACRO()
--- /dev/null
+#####
+##
+## Copyright (C) 2012 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## <TODO: Full License information>
+## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later
+## version of the LGPL license.
+##
+## Author: Matthias Maier <matthias.maier@iwr.uni-heidelberg.de>
+##
+#####
+
+#
+# Replace all occurences of "${flag}" with "${replacement}" in the string
+# variable.
+#
+# Usage:
+# STRIP_FLAG(variable flag replacement)
+#
+
+MACRO(REPLACE_FLAG _variable _flag _replacement)
+ STRING(STRIP "${_replacement}" _replacement_stripped)
+ STRING(REPLACE " " " " ${_variable} "${${_variable}}")
+ SET(${_variable} " ${${_variable}} ")
+ STRING(REPLACE " " " " _flag2 "${_flag}")
+ IF(NOT "${_replacement_stripped}" STREQUAL "")
+ STRING(REPLACE " ${_flag2} " " ${_replacement_stripped} " ${_variable} "${${_variable}}")
+ ELSE()
+ STRING(REPLACE " ${_flag2} " " " ${_variable} "${${_variable}}")
+ ENDIF()
+ STRING(REPLACE " " " " ${_variable} "${${_variable}}")
+ STRING(STRIP "${${_variable}}" ${_variable})
+ENDMACRO()
#
MACRO(STRIP_FLAG _variable _flag)
+ STRING(REPLACE " " " " ${_variable} "${${_variable}}")
SET(${_variable} " ${${_variable}} ")
- STRING(REPLACE " ${_flag} " " " "${_variable}" ${${_variable}})
+ STRING(REPLACE " " " " _flag2 "${_flag}")
+ STRING(REPLACE " ${_flag2} " " " ${_variable} "${${_variable}}")
+ STRING(REPLACE " " " " ${_variable} "${${_variable}}")
STRING(STRIP "${${_variable}}" ${_variable})
ENDMACRO()