Support macos

This commit is contained in:
2022-04-04 10:19:12 +02:00
parent 82559cb9a7
commit 4f0be88f01

View File

@@ -38,7 +38,19 @@ function(bundle_static_library tgt_name bundled_tgt_name)
set(bundled_tgt_full_name
${CMAKE_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${bundled_tgt_name}${CMAKE_STATIC_LIBRARY_SUFFIX})
if (UNIX OR APPLE)
if (APPLE)
find_program(lib_tool libtool)
foreach(tgt IN LISTS static_libs)
list(APPEND static_libs_full_names $<TARGET_FILE:${tgt}>)
endforeach()
add_custom_command(
COMMAND ${lib_tool} -static -o ${bundled_tgt_full_name} ${static_libs_full_names}
OUTPUT ${bundled_tgt_full_name}
COMMENT "Bundling ${bundled_tgt_name}"
VERBATIM)
elseif(UNIX)
file(WRITE ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar.in
"CREATE ${bundled_tgt_full_name}\n" )
@@ -64,7 +76,7 @@ function(bundle_static_library tgt_name bundled_tgt_name)
OUTPUT ${bundled_tgt_full_name}
COMMENT "Bundling ${bundled_tgt_name}"
VERBATIM)
elseif(MSVC)
elseif(WIN32)
find_program(lib_tool lib)
foreach(tgt IN LISTS static_libs)