Blob Blame History Raw
diff -up ./CMakeLists.txt.pkgconfig ./CMakeLists.txt
--- ./CMakeLists.txt.pkgconfig	2018-11-19 17:34:10.000000000 -0500
+++ ./CMakeLists.txt	2019-02-23 12:03:23.424394187 -0500
@@ -369,14 +369,19 @@ else (build_errors)
   endif(NOT "${Boost_PKGCONFIG_LIBS}" STREQUAL "")
   string (REPLACE ";" " -L" Boost_PKGCONFIG_LIBS "${Boost_PKGCONFIG_LIBS}")
 
+  message(STATUS "Generating pkg-config libs from ${Boost_LIBRARIES}")
   foreach (b ${Boost_LIBRARIES})
     get_filename_component(bname ${b} NAME_WE)
-    # Prefix always -l
-    set (bname "-l${bname}")
+    # Prefix -l if not already prefixed
+    string(FIND ${bname} "-l" lprefix)
+    if (NOT ${lprefix} EQUAL 0 )
+      set (bname "-l${bname}")
+    endif()
     # Remove the prefix lib (not always present, like in pthread)
     string (REPLACE "lib" "" bname "${bname}")
     set (Boost_PKGCONFIG_LIBS "${Boost_PKGCONFIG_LIBS} ${bname}")
   endforeach(b)
+  message(STATUS "Generated pkg-config libs ${Boost_PKGCONFIG_LIBS}")
 
   foreach (pkgconfig ${pkgconfig_files})
     configure_file(${CMAKE_SOURCE_DIR}/cmake/pkgconfig/${pkgconfig}.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/pkgconfig/${pkgconfig}.pc @ONLY)