From 878ecb7355bbe90b5afea2548f08a2a8236e8f83 Mon Sep 17 00:00:00 2001 From: Bob Chen Date: Tue, 10 Oct 2023 11:02:01 +0800 Subject: [PATCH] fix-archieve-merge-on-macOS (#195) --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 736be2be..2cd793c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,9 +306,14 @@ target_link_libraries(photon_static # Merge static libs into libphoton.a # Do NOT use this target directly. +if (NOT APPLE) + set(merge_command ar -crT libphoton.a) +else () + set(merge_command libtool -static -o libphoton.a) +endif () add_custom_target(_photon_static_archive ALL COMMAND rm -rf libphoton.a - COMMAND ar -crT libphoton.a $ $ $ + COMMAND ${merge_command} $ $ $ DEPENDS photon_static WORKING_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} VERBATIM