summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2011-11-21 23:45:49 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2011-11-21 23:45:49 (GMT)
commit9a6b102205045e457db24bd00777ef000c30e242 (patch)
tree616ce9fe9aaa98cea9c0e49f9effdd4a61409aee
parentad9bffdc3c1b43e0a3c3f47e9ee8d3bff487324e (diff)
downloadCMake-9a6b102205045e457db24bd00777ef000c30e242.zip
CMake-9a6b102205045e457db24bd00777ef000c30e242.tar.gz
CMake-9a6b102205045e457db24bd00777ef000c30e242.tar.bz2
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.
-rw-r--r--Modules/GetPrerequisites.cmake30
1 files changed, 27 insertions, 3 deletions
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 2efa079..fbbaf9c 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -304,6 +304,26 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
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)
find_file(ri "${item}" ${exepath} ${dirs} /usr/lib)
@@ -458,9 +478,13 @@ 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}")
- set(is_local 1)
+ 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()