1 include(BundleUtilities)
3 # due to the strange way that gp_resolve_item_override works, need to copy in the whole darn function
4 # the default function needs to be overridden so that cuda's funky linked @rpath/libtlshook.dylib can be resolved
6 function(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var)
8 set(resolved_item "${item}")
10 # just remove rpath, we don't need it and doing so enables the lib to be found
11 if(item MATCHES "@rpath")
12 string(REPLACE "@rpath" "" ni "${item}")
14 endif(item MATCHES "@rpath")
16 # THE REST OF THIS FUNCTION IS AS IS FROM CMAKE, exept where the override is not called and resolved_var is set
18 # Is it already resolved?
20 if(EXISTS "${resolved_item}")
22 endif(EXISTS "${resolved_item}")
25 if(item MATCHES "@executable_path")
27 # @executable_path references are assumed relative to exepath
29 string(REPLACE "@executable_path" "${exepath}" ri "${item}")
30 get_filename_component(ri "${ri}" ABSOLUTE)
33 #message(STATUS "info: embedded item exists (${ri})")
35 set(resolved_item "${ri}")
37 message(STATUS "warning: embedded item does not exist '${ri}'")
39 endif(item MATCHES "@executable_path")
43 if(item MATCHES "@loader_path")
45 # @loader_path references are assumed relative to the
46 # PATH of the given "context" (presumably another library)
48 get_filename_component(contextpath "${context}" PATH)
49 string(REPLACE "@loader_path" "${contextpath}" ri "${item}")
50 get_filename_component(ri "${ri}" ABSOLUTE)
53 #message(STATUS "info: embedded item exists (${ri})")
55 set(resolved_item "${ri}")
57 message(STATUS "warning: embedded item does not exist '${ri}'")
59 endif(item MATCHES "@loader_path")
64 find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
65 find_file(ri "${item}" ${exepath} ${dirs} /usr/lib)
67 #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
69 set(resolved_item "${ri}")
75 if(item MATCHES "[^/]+\\.framework/")
77 find_file(fw "${item}"
78 "~/Library/Frameworks"
80 "/System/Library/Frameworks"
83 #message(STATUS "info: 'find_file' found framework (${fw})")
85 set(resolved_item "${fw}")
88 endif(item MATCHES "[^/]+\\.framework/")
91 # Using find_program on Windows will find dll files that are in the PATH.
92 # (Converting simple file names into full path names if found.)
94 if(WIN32 AND NOT UNIX)
97 find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
98 find_program(ri "${item}" PATHS "${exepath};${dirs}")
100 #message(STATUS "info: 'find_program' in exepath/dirs (${ri})")
102 set(resolved_item "${ri}")
103 set(ri "ri-NOTFOUND")
106 endif(WIN32 AND NOT UNIX)
110 warning: cannot resolve item '${item}'
113 need more directories?
114 need to use InstallRequiredSystemLibraries?
115 run in install tree instead of build tree?
118 #******************************************************************************
119 #warning: cannot resolve item '${item}'
122 # need more directories?
123 # need to use InstallRequiredSystemLibraries?
124 # run in install tree instead of build tree?
126 # context='${context}'
128 # exepath='${exepath}'
130 # resolved_item_var='${resolved_item_var}'
131 #******************************************************************************
135 set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE)
136 set(${resolved_var} "${resolved}" PARENT_SCOPE)
138 endfunction(gp_resolve_item_override)
140 fixup_bundle("${CMAKE_INSTALL_PREFIX}/HOOMD-blue.app"
141 "${CMAKE_INSTALL_PREFIX}/@BIN_INSTALL_DIR@/hoomd.so"