DEV-34837: Allow Mac SL executable to find libllcommon.dylib in app bundle's

Resources subdir without requiring user to explicitly set DYLD_LIBRARY_PATH.
Engage the SHARED_LIB_STAGING_DIR mechanism for Mac as well as Windows and
Linux so unit-test executables, too, can find libllcommon.dylib. Perform the
POST_BUILD copy of libllcommon.dylib to SHARED_LIB_STAGING_DIR everywhere but
Windows -- but make it conditional on SHARED_LIB_STAGING_DIR.
master
Nat Goodspeed 2009-08-04 13:51:50 -04:00
parent 0ac96fd8e6
commit 47e547fcba
2 changed files with 15 additions and 8 deletions

View File

@ -19,6 +19,7 @@ if (NOT STANDALONE)
set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release)
set(ARCH_PREBUILT_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS_RELEASE})
set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged DLLs")
endif (WINDOWS)
endif (NOT STANDALONE)

View File

@ -244,22 +244,28 @@ if(LLCOMMON_LINK_SHARED)
# llcommon.dll get written to the DLL staging directory.
# Also this directory is shared with RunBuildTest.cmake, y'know, for the tests.
set_target_properties(llcommon PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR})
endif(SHARED_LIB_STAGING_DIR)
if(LINUX)
get_target_property(LLCOMMON_PATH llcommon LOCATION)
get_filename_component(LLCOMMON_FILE ${LLCOMMON_PATH} NAME)
add_custom_command(
if(NOT WINDOWS)
get_target_property(LLCOMMON_PATH llcommon LOCATION)
get_filename_component(LLCOMMON_FILE ${LLCOMMON_PATH} NAME)
add_custom_command(
TARGET llcommon POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS
-E
copy_if_different
${LLCOMMON_FILE}
${LLCOMMON_PATH}
${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/${LLCOMMON_FILE}
COMMENT "Copying llcommon to the staging folder."
)
endif(LINUX)
endif(NOT WINDOWS)
endif(SHARED_LIB_STAGING_DIR)
if (DARWIN)
set_target_properties(llcommon PROPERTIES
BUILD_WITH_INSTALL_RPATH 1
INSTALL_NAME_DIR "@executable_path/../Resources"
)
endif(DARWIN)
else(LLCOMMON_LINK_SHARED)
add_library (llcommon ${llcommon_SOURCE_FILES})