it...
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26632
0785d39b-7218-0410-832d-
ea1e28bc413d
--- /dev/null
+#
+# Tests whether it is possible to compile and link a dummy program with a
+# given flag.
+# If so, add it to variable.
+#
+# Usage:
+# ENABLE_IF_LINKS(variable flag)
+#
+
+MACRO(ENABLE_IF_LINKS variable flag)
+ ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${flag}")
+ CHECK_CXX_SOURCE_COMPILES(
+ "
+ int main() { return 0; }
+ "
+ DEAL_II_HAVE_FLAG_${flag}
+ )
+ STRIP_FLAG(CMAKE_REQUIRED_FLAGS "${flag}")
+ IF(DEAL_II_HAVE_FLAG_${flag})
+ SET(${variable} "${${variable}} ${flag}")
+ ENDIF()
+ENDMACRO()
+
# Check whether the -as-needed flag is available. If so set it to link
# the deal.II library with it.
#
-ENABLE_IF_SUPPORTED(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
+ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
#
# you accidentally defined one symbol multiple times...
# (added 2005/07/13, Ralf B. Schulz)
# (modified 2005/12/20, Ralf B. Schulz)
- ENABLE_IF_SUPPORTED(CMAKE_SHARED_LINKER_FLAGS
- "-Xlinker --allow-multiple-definition")
+ ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS
+ "-Xlinker --allow-multiple-definition"
+ )
ENDIF()
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams