From 134a381685160ecd58f45d3ca527d5fa9bee51fd Mon Sep 17 00:00:00 2001
From: Martin Hierholzer <martin.hierholzer@desy.de>
Date: Tue, 5 Feb 2019 16:37:31 +0100
Subject: [PATCH] fix issue that a double "-l" can appear in the Makefile
 config shell scripts for libraries which already contain the -l

---
 cmake/create_cmake_config_files.cmake | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmake/create_cmake_config_files.cmake b/cmake/create_cmake_config_files.cmake
index af2c07d..fe03409 100644
--- a/cmake/create_cmake_config_files.cmake
+++ b/cmake/create_cmake_config_files.cmake
@@ -44,9 +44,11 @@ endforeach()
 
 string(REPLACE " " ";" LIST "${PROJECT_NAME} ${${PROJECT_NAME}_LIBRARIES}")
 foreach(LIBRARY ${LIST})
-  if(LIBRARY MATCHES "/")  # library name contains slashes: link against the a file path name
+  if(LIBRARY MATCHES "/")         # library name contains slashes: link against the a file path name
     set(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE} ${LIBRARY}")
-  else()                   # library name does not contain slashes: link against library with -l option
+  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}")
+  else()                          # link against library with -l option
     set(${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE "${${PROJECT_NAME}_LINKER_FLAGS_MAKEFILE} -l${LIBRARY}")
   endif()
 endforeach()
-- 
GitLab