GetPrerequisites: Add support for @rpath on Mac OS X.

Handle @rpath much like other Unixes, by doing a find_file with the given directories.

Also, consider a library to be local if it is found in the same directory or a subdirectory relative to the user
executable/library.  Previously, it was local only if found in the same directory.
This case is encountered when @rpath is used with framework libraries, which are inside a directory tree.
This commit is contained in:
Clinton Stimpson 2011-11-21 16:45:49 -07:00
parent ad9bffdc3c
commit 9a6b102205
1 changed files with 27 additions and 3 deletions

View File

@ -303,6 +303,26 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
endif(item MATCHES "@loader_path")
endif(NOT resolved)
if(NOT resolved)
if(item MATCHES "@rpath")
#
# @rpath references are relative to the paths built into the binaries with -rpath
# We handle this case like we do for other Unixes
#
string(REPLACE "@rpath/" "" norpath_item "${item}")
set(ri "ri-NOTFOUND")
find_file(ri "${norpath_item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
if(ri)
#message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
set(resolved 1)
set(resolved_item "${ri}")
set(ri "ri-NOTFOUND")
endif(ri)
endif(item MATCHES "@rpath")
endif(NOT resolved)
if(NOT resolved)
set(ri "ri-NOTFOUND")
find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
@ -458,12 +478,16 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
if(NOT is_system)
get_filename_component(original_path "${original_lower}" PATH)
get_filename_component(path "${lower}" PATH)
if("${original_path}" STREQUAL "${path}")
string(LENGTH "${original_path}/" original_length)
string(LENGTH "${lower}" path_length)
if(${path_length} GREATER ${original_length})
string(SUBSTRING "${lower}" 0 ${original_length} path)
if("${original_path}/" STREQUAL "${path}")
set(is_local 1)
endif()
endif()
endif()
endif()
# Return type string based on computed booleans:
#