summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-12-28 21:18:22 +0000
committerSadie Powell <sadie@witchery.services>2021-12-28 21:18:22 +0000
commit2c18601d8f3a3b5ab8ddb3ecdd90a2c69c7fbc88 (patch)
treedde08204d2283e865bf86f341e6585808d6ce833 /cmake
parenta1a1b3ad018c7a54b82a2b0f4dcbac9691f6ba8b (diff)
Fix linking against libraries by their alternate name.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Anope.cmake10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmake/Anope.cmake b/cmake/Anope.cmake
index 488d0f4f1..1b924bc5d 100644
--- a/cmake/Anope.cmake
+++ b/cmake/Anope.cmake
@@ -460,15 +460,17 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
endif(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
# If the library was found, we will add it to the linker flags
if(FOUND_${LIBRARY}_LIBRARY)
- # Get the path only of the library, to add it to linker flags
- get_filename_component(LIBRARY_PATH ${FOUND_${LIBRARY}_LIBRARY} PATH)
if(MSVC)
# For Visual Studio, instead of editing the linker flags, we'll add the library to a separate list of extra dependencies
append_to_list(EXTRA_DEPENDENCIES "${FOUND_${LIBRARY}_LIBRARY}")
else(MSVC)
- # For all others, add the library paths and libraries
+ # Get the path only of the library, to add it to library paths.
+ get_filename_component(LIBRARY_PATH ${FOUND_${LIBRARY}_LIBRARY} PATH)
append_to_list(LIBRARY_PATHS "${LIBRARY_PATH}")
- append_to_list(LIBRARIES "${LIBRARY}")
+ # Extract the library short name, add it to the library path
+ get_filename_component(LIBRARY_NAME ${FOUND_${LIBRARY}_LIBRARY} NAME_WE)
+ string(REGEX REPLACE "^lib" "" LIBRARY_NAME ${LIBRARY_NAME})
+ append_to_list(LIBRARIES ${LIBRARY_NAME})
endif(MSVC)
else(FOUND_${LIBRARY}_LIBRARY)
# In the case of the library not being found, we fatally error so CMake stops trying to generate