Fix finding the lib program when using the Visual Studio generator

This commit is contained in:
Duncan Ogilvie 2022-05-02 21:02:45 +02:00
parent b660ce5c8d
commit 7b80294606

View File

@ -44,7 +44,7 @@ function(bundle_static_library tgt_name bundled_tgt_name library_name)
${CMAKE_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${library_name}${CMAKE_STATIC_LIBRARY_SUFFIX})
if (APPLE)
find_program(lib_tool libtool)
find_program(lib_tool libtool REQUIRED)
foreach(tgt IN LISTS static_libs)
list(APPEND static_libs_full_names $<TARGET_FILE:${tgt}>)
@ -82,7 +82,10 @@ function(bundle_static_library tgt_name bundled_tgt_name library_name)
COMMENT "Bundling ${bundled_tgt_name}"
VERBATIM)
elseif(WIN32)
find_program(lib_tool lib)
# https://stackoverflow.com/a/38096930/1806760
get_filename_component(vs_bin_path "${CMAKE_LINKER}" DIRECTORY)
find_program(lib_tool lib HINTS "${vs_bin_path}" REQUIRED)
foreach(tgt IN LISTS static_libs)
list(APPEND static_libs_full_names $<TARGET_FILE:${tgt}>)