Mac: Set rpath instead of using install_name_tool from CMake (issue #1403)

This commit is contained in:
Marshall Greenblatt 2016-09-02 16:59:39 +03:00
parent 96b368ed14
commit 40558a0922
3 changed files with 20 additions and 26 deletions

View File

@ -185,26 +185,20 @@ endif(OS_LINUX)
if(OS_MACOSX) if(OS_MACOSX)
# Fix the framework link in the helper executable. # Fix the framework rpath in the helper executable.
macro(FIX_MACOSX_HELPER_FRAMEWORK_LINK target app_path) macro(FIX_MACOSX_HELPER_FRAMEWORK_RPATH target)
add_custom_command(TARGET ${target} # The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
POST_BUILD # so set rpath up to Contents/ so that the loader can find Frameworks/.
COMMAND install_name_tool -change "@executable_path/Chromium Embedded Framework" set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/../../../..")
"@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
"${app_path}/Contents/MacOS/${target}"
VERBATIM
)
endmacro() endmacro()
# Fix the framework link in the main executable. # Fix the framework rpath in the main executable.
macro(FIX_MACOSX_MAIN_FRAMEWORK_LINK target app_path) macro(FIX_MACOSX_MAIN_FRAMEWORK_RPATH target)
add_custom_command(TARGET ${target} # The main app is at $app_name.app/Contents/MacOS/$app_name
POST_BUILD # so set rpath up to Contents/ so that the loader can find Frameworks/.
COMMAND install_name_tool -change "@executable_path/Chromium Embedded Framework" set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/..")
"@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
"${app_path}/Contents/MacOS/${target}"
VERBATIM
)
endmacro() endmacro()
# Manually process and copy over resource files. # Manually process and copy over resource files.

View File

@ -178,8 +178,8 @@ if(OS_MACOSX)
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/helper-Info.plist MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/helper-Info.plist
) )
# Fix the framework link in the helper executable. # Fix the framework rpath in the helper executable.
FIX_MACOSX_HELPER_FRAMEWORK_LINK(${CEF_HELPER_TARGET} ${CEF_HELPER_APP}) FIX_MACOSX_HELPER_FRAMEWORK_RPATH(${CEF_HELPER_TARGET})
# Main executable target. # Main executable target.
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS}) add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS})
@ -206,8 +206,8 @@ if(OS_MACOSX)
VERBATIM VERBATIM
) )
# Fix the framework link in the main executable. # Fix the framework rpath in the main executable.
FIX_MACOSX_MAIN_FRAMEWORK_LINK(${CEF_TARGET} ${CEF_APP}) FIX_MACOSX_MAIN_FRAMEWORK_RPATH(${CEF_TARGET})
if(NOT ${CMAKE_GENERATOR} STREQUAL "Xcode") if(NOT ${CMAKE_GENERATOR} STREQUAL "Xcode")
# Manually process and copy over resource files. # Manually process and copy over resource files.

View File

@ -99,8 +99,8 @@ if(OS_MACOSX)
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist
) )
# Fix the framework link in the helper executable. # Fix the framework rpath in the helper executable.
FIX_MACOSX_HELPER_FRAMEWORK_LINK(${CEF_HELPER_TARGET} ${CEF_HELPER_APP}) FIX_MACOSX_HELPER_FRAMEWORK_RPATH(${CEF_HELPER_TARGET})
# Main executable target. # Main executable target.
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_RESOURCES_SRCS} ${CEFSIMPLE_SRCS}) add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_RESOURCES_SRCS} ${CEFSIMPLE_SRCS})
@ -127,8 +127,8 @@ if(OS_MACOSX)
VERBATIM VERBATIM
) )
# Fix the framework link in the main executable. # Fix the framework rpath in the main executable.
FIX_MACOSX_MAIN_FRAMEWORK_LINK(${CEF_TARGET} ${CEF_APP}) FIX_MACOSX_MAIN_FRAMEWORK_RPATH(${CEF_TARGET})
if(NOT ${CMAKE_GENERATOR} STREQUAL "Xcode") if(NOT ${CMAKE_GENERATOR} STREQUAL "Xcode")
# Manually process and copy over resource files. # Manually process and copy over resource files.