From e9a6cbb3725daf3c81e04aa99de89f99be80f7ef Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Tue, 6 Jan 2015 20:21:59 +0100 Subject: [PATCH] CMake: Build up library name directly 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 | 15 +++++++++++---- cmake/setup_finalize.cmake | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake/config/CMakeLists.txt b/cmake/config/CMakeLists.txt index 6e16425db1..1e99a4fe44 100644 --- a/cmake/config/CMakeLists.txt +++ b/cmake/config/CMakeLists.txt @@ -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} diff --git a/cmake/setup_finalize.cmake b/cmake/setup_finalize.cmake index df8eb59672..6dd72d4658 100644 --- a/cmake/setup_finalize.cmake +++ b/cmake/setup_finalize.cmake @@ -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 -- 2.39.5