]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Build up library name directly
authorMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 6 Jan 2015 19:21:59 +0000 (20:21 +0100)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Mon, 12 Jan 2015 22:21:58 +0000 (23:21 +0100)
The LOCATION property is deprecated starting with CMake 3.0. Further it
leads to an astonishing bug if used in CMake 3.1 [1]. Thus, we have to
build up the library name by hand.

[1] http://public.kitware.com/Bug/view.php?id=15338

cmake/config/CMakeLists.txt
cmake/setup_finalize.cmake

index 6e16425db15f0447ef463a9502b902ea3ca2981d..1e99a4fe44d9db688e39ec532f12a76b27e875fe 100644 (file)
@@ -1,6 +1,6 @@
 ## ---------------------------------------------------------------------
 ##
-## Copyright (C) 2012 - 2014 by the deal.II authors
+## Copyright (C) 2012 - 2015 by the deal.II authors
 ##
 ## This file is part of the deal.II library.
 ##
@@ -94,10 +94,17 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES})
   ENDIF()
 
   #
-  # Get library name directly from the target:
+  # Build up library name depending on link type:
   #
-  GET_TARGET_PROPERTY(_lib ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX} LOCATION)
-  GET_FILENAME_COMPONENT(CONFIG_LIBRARY_${_build} "${_lib}" NAME)
+  IF(BUILD_SHARED_LIBS)
+    SET(CONFIG_LIBRARY_${_build}
+      "${CMAKE_SHARED_LIBRARY_PREFIX}${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+      )
+  ELSE()
+    SET(CONFIG_LIBRARY_${_build}
+      "${CMAKE_STATIC_LIBRARY_PREFIX}${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+      )
+  ENDIF()
 
   IF(CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "Windows")
     SET(CONFIG_LIBRARIES_${_build}
index df8eb59672c22e176af486957932c1fd2f11c0df..6dd72d4658a6b1da6fda01bc40647685c39656ff 100644 (file)
@@ -78,7 +78,7 @@ FOREACH(_suffix ${DEAL_II_LIST_SUFFIXES})
 ENDFOREACH()
 
 #
-# Cleanup deal.IITargets.cmake in the build directory:
+# Clean up deal.IITargets.cmake in the build directory:
 #
 FILE(REMOVE
   ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake

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.