Compare commits

...

1 Commits

Author SHA1 Message Date
a18949446876 129a0c96c2 Update change_rpath.cmake 2023-09-02 21:14:51 +08:00
1 changed files with 19 additions and 0 deletions

View File

@ -1,9 +1,16 @@
# "changerpath" CMaketarget_sotarget_name link_sos
function(changerpath target_so target_name link_sos)
# depend_so
set(depend_so "")
# link_sos
foreach(link_so ${link_sos})
# some-file otool
set(some-file "${CMAKE_SOURCE_DIR}/build/${target_name}_${link_so}.txt")
set(some-file1 "${CMAKE_SOURCE_DIR}/build/${target_name}_${link_so}1.txt")
set(some-file2 "${CMAKE_SOURCE_DIR}/build/${target_name}_${link_so}2.txt")
# otool
add_custom_command(
OUTPUT
${some-file}
@ -12,6 +19,8 @@ function(changerpath target_so target_name link_sos)
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/build"
VERBATIM
)
#
add_custom_command(
OUTPUT
${some-file1}
@ -22,6 +31,8 @@ function(changerpath target_so target_name link_sos)
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/build"
VERBATIM
)
#
add_custom_command(
OUTPUT
${some-file2}
@ -32,6 +43,8 @@ function(changerpath target_so target_name link_sos)
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/build"
VERBATIM
)
# install_name_tool
add_custom_target(
link_${target_name}_${link_so} ALL
COMMAND install_name_tool -change `cat ${some-file1}` @rpath/`cat ${some-file2}` ${target_so}
@ -39,6 +52,8 @@ function(changerpath target_so target_name link_sos)
DEPENDS ${target_so} ${some-file1} ${some-file2}
COMMENT "install tool name"
)
# link_${target_name}_${link_so}
add_custom_command(
TARGET link_${target_name}_${link_so}
POST_BUILD
@ -46,9 +61,13 @@ function(changerpath target_so target_name link_sos)
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/build"
VERBATIM
)
# depend_so
if(depend_so)
add_dependencies(link_${target_name}_${link_so} link_${target_name}_${depend_so})
endif()
# depend_so 便使
set(depend_so ${link_so})
endforeach()
endfunction()