Proper name of FMOD .dylib in loading path adjustment for macOS

This commit is contained in:
alexey.lysiuk 2016-09-06 12:43:57 +03:00 committed by Christoph Oelckers
parent 9c91686e0f
commit b308a7df52

View file

@ -1392,17 +1392,23 @@ if( APPLE )
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/posix/osx/zdoom-info.plist" )
if( NOT NO_FMOD )
if( FMOD_STUDIO )
set( FMOD_DYLIB libfmod.dylib )
else()
set( FMOD_DYLIB libfmodex.dylib )
endif()
# Fix fmod link so that it can be found in the app bundle.
find_program( OTOOL otool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" )
find_program( INSTALL_NAME_TOOL install_name_tool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" )
execute_process( COMMAND "${OTOOL}" -L "${FMOD_LIBRARY}"
COMMAND grep "libfmodex.dylib (compat"
COMMAND grep "${FMOD_DYLIB} (compat"
COMMAND head -n1
COMMAND awk "{print $1}"
OUTPUT_VARIABLE FMOD_LINK
OUTPUT_STRIP_TRAILING_WHITESPACE )
add_custom_command( TARGET zdoom POST_BUILD
COMMAND "${INSTALL_NAME_TOOL}" -change "${FMOD_LINK}" @executable_path/../Frameworks/libfmodex.dylib "$<TARGET_FILE:zdoom>"
COMMAND "${INSTALL_NAME_TOOL}" -change "${FMOD_LINK}" @executable_path/../Frameworks/${FMOD_DYLIB} "$<TARGET_FILE:zdoom>"
COMMENT "Relinking FMOD Ex" )
endif()
endif()