From c2027f8ff6a4e280f9c4f4a07d40f7d184faa162 Mon Sep 17 00:00:00 2001
From: Jens Georg <jens.georg@desy.de>
Date: Mon, 14 Oct 2019 16:36:39 +0200
Subject: [PATCH] Resolve cmake targets in the config scripts

THis is necessary for newer Boost (1.71) which puts the exported targets
in Boost_LIBRARIES. If we export that verbatim it causes link issues on
projects using the config scripts from Make
---
 cmake/create_cmake_config_files.cmake | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cmake/create_cmake_config_files.cmake b/cmake/create_cmake_config_files.cmake
index 13fc78d..5a8ce37 100644
--- a/cmake/create_cmake_config_files.cmake
+++ b/cmake/create_cmake_config_files.cmake
@@ -48,6 +48,9 @@ foreach(LIBRARY ${LIST})
     set(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE} ${LIBRARY}")
   elseif(LIBRARY MATCHES "^-l")   # library name does not contain slashes but already the -l option: directly quote it
     set(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE} ${LIBRARY}")
+  elseif(LIBRARY MATCHES "::")  # library name is an exported target - we need to resolve it for Makefiles
+    get_property(lib_loc TARGET ${LIBRARY} PROPERTY LOCATION)
+    string(APPEND ${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE " ${lib_loc}")
   else()                          # link against library with -l option
     set(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE} -l${LIBRARY}")
   endif()
-- 
GitLab