Skip to content

Commit

Permalink
fix-archieve-merge-on-macOS (alibaba#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
beef9999 authored Oct 10, 2023
1 parent 7a97c84 commit 878ecb7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_FILE:photon_static> $<TARGET_FILE:easy_weak> $<TARGET_FILE:fstack_weak>
COMMAND ${merge_command} $<TARGET_FILE:photon_static> $<TARGET_FILE:easy_weak> $<TARGET_FILE:fstack_weak>
DEPENDS photon_static
WORKING_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
VERBATIM
Expand Down

0 comments on commit 878ecb7

Please sign in to comment.