]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: Bugfix: Implement ENABLE_IF_LINKS with CHECK_CXX_COMPILER_FLAG
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Mar 2013 17:11:26 +0000 (17:11 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Mar 2013 17:11:26 +0000 (17:11 +0000)
git-svn-id: https://svn.dealii.org/trunk@29080 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/macros/macro_enable_if_links.cmake
deal.II/cmake/macros/macro_enable_if_supported.cmake

index 6fcfb9133c873aefe39de3fd066e14d42f0c8503..c12936568c4639b9fa6bc1d2098390e22d4987d2 100644 (file)
 
 MACRO(ENABLE_IF_LINKS _variable _flag)
   STRING(STRIP "${_flag}" _flag_stripped)
-  STRING(REGEX REPLACE "^-" "" _flag_name "${_flag_stripped}")
-  STRING(REPLACE "," "" _flag_name "${_flag_name}")
-  STRING(REPLACE "-" "_" _flag_name "${_flag_name}")
-
   IF(NOT "${_flag_stripped}" STREQUAL "")
+    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}")
-    CHECK_CXX_SOURCE_COMPILES(
-    "
-    int main() { return 0; }
-    "
-    DEAL_II_HAVE_FLAG_${_flag_name}
-    )
+    CHECK_CXX_COMPILER_FLAG(
+      ""
+      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}")
@@ -42,4 +39,3 @@ MACRO(ENABLE_IF_LINKS _variable _flag)
     ENDIF()
   ENDIF()
 ENDMACRO()
-
index bd989f8877b40c101e357c10e220e1d00770c6ca..9c98c9155ea74fca9b8c45d135074d6aa0b3e253 100644 (file)
@@ -25,7 +25,7 @@ MACRO(ENABLE_IF_SUPPORTED _variable _flag)
   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}")
     CHECK_CXX_COMPILER_FLAG(
       "${_flag_stripped}"
       DEAL_II_HAVE_FLAG_${_flag_name}

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


Typeset in Trocchi and Trocchi Bold Sans Serif.