]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Work around empty CMAKE_*_LIBRARY-*FIX 7533/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 15 Dec 2018 10:38:56 +0000 (11:38 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 15 Dec 2018 11:04:29 +0000 (12:04 +0100)
cmake/config/CMakeLists.txt

index e16d77a111dfdddc6fa453fc5cf4c0ad52457a1f..5c851ff67f78dc21e9d24125b380bf619216a731 100644 (file)
@@ -246,6 +246,28 @@ ENDFOREACH()
 # export PKG_CONFIG_PATH=/path/to/INSTALL_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
 #
 
+#
+# We need to gather some variables for the regex below to work.
+#
+
+SET(_library_prefixes "")
+IF (CMAKE_SHARED_LIBRARY_PREFIX)
+  LIST(APPEND _library_prefixes ${CMAKE_SHARED_LIBRARY_PREFIX})
+ENDIF()
+IF (CMAKE_STATIC_LIBRARY_PREFIX)
+  LIST(APPEND _library_prefixes ${CMAKE_STATIC_LIBRARY_PREFIX})
+ENDIF()
+STRING(REPLACE ";" "|" _library_prefixes "${_library_prefixes}")
+
+SET(_library_suffixes "")
+IF (CMAKE_SHARED_LIBRARY_SUFFIX)
+  LIST(APPEND _library_suffixes ${CMAKE_SHARED_LIBRARY_SUFFIX})
+ENDIF()
+IF (CMAKE_STATIC_LIBRARY_SUFFIX)
+  LIST(APPEND _library_suffixes ${CMAKE_STATIC_LIBRARY_SUFFIX})
+ENDIF()
+STRING(REPLACE ";" "|" _library_suffixes "${_library_suffixes}")
+
 #
 # Build up the link line from our list of libraries:
 #
@@ -283,14 +305,12 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES})
       ENDIF()
 
       # Recover short name:
-      STRING(REGEX REPLACE
-        "^(${CMAKE_STATIC_LIBRARY_PREFIX}|${CMAKE_SHARED_LIBRARY_PREFIX})"
-        "" _name "${_name}"
-        )
-      STRING(REGEX REPLACE
-        "(${CMAKE_STATIC_LIBRARY_SUFFIX}|${CMAKE_SHARED_LIBRARY_SUFFIX})$"
-        "" _name "${_name}"
-        )
+      IF(_library_prefixes)
+        STRING(REGEX REPLACE "^(${_library_prefixes})" "" _name "${_name}")
+      ENDIF()
+      IF(_library_suffixes)
+        STRING(REGEX REPLACE "(${_library_suffixes})$" "" _name "${_name}")
+      ENDIF()
       SET(_library_string "${_library_string}-l${_name}")
     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


Typeset in Trocchi and Trocchi Bold Sans Serif.