Skip to content

Commit

Permalink
* Accounting for spaces in library paths
Browse files Browse the repository at this point in the history
* Ignore debug and optimized CMake hints.

Signed-off-by: Guybrush <[email protected]>
  • Loading branch information
MiguelBarro authored and alanxz committed Mar 19, 2024
1 parent 7e0630a commit bcee332
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,24 @@ else(WIN32)
endif(WIN32)

foreach(_lib ${Boost_LIBRARIES})

# Check if FindBoost.cmake provided actual library paths or targets
if(TARGET ${_lib})
get_target_property(_lib ${_lib} LOCATION)
endif()

get_filename_component(_LIBPATH ${_lib} PATH)
if (NOT _LIBPATH STREQUAL _LASTLIBPATH)
set(libs_private "${libs_private} -L${_LIBPATH}")
if (NOT _LIBPATH STREQUAL _LASTLIBPATH AND NOT _LIBPATH STREQUAL "")
set(libs_private "${libs_private} -L\"${_LIBPATH}\"")
set(_LASTLIBPATH ${_LIBPATH})
endif()

get_filename_component(_LIBNAME ${_lib} NAME_WE)
string(REGEX REPLACE "^lib" "" _LIBNAME ${_LIBNAME})
set(_LIBNAME "-l${_LIBNAME}")
set(libs_private "${libs_private} ${_LIBNAME}")
if (NOT _LIBNAME STREQUAL "debug" AND NOT _LIBNAME STREQUAL "optimized")
string(REGEX REPLACE "^lib" "" _LIBNAME ${_LIBNAME})
set(_LIBNAME "-l${_LIBNAME}")
set(libs_private "${libs_private} ${_LIBNAME}")
endif()
endforeach()

configure_file(libSimpleAmqpClient.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libSimpleAmqpClient.pc @ONLY)
Expand Down

0 comments on commit bcee332

Please sign in to comment.