-
Notifications
You must be signed in to change notification settings - Fork 14
Fix Jsonnet Library Loading On MacOS #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
cb5ec7d
3c92e64
55229b0
b6f059d
5f9434d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,38 @@ if(${CMAKE_FIND_PACKAGE_NAME}_FOUND) | |
| set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS | ||
| ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS} | ||
| ) | ||
|
|
||
| # On macOS, fix jsonnet libraries if they have incorrect install_name | ||
| if(APPLE) | ||
| foreach(_lib ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY} | ||
| ${${CMAKE_FIND_PACKAGE_NAME}_CLIBRARY}) | ||
| if(EXISTS "${_lib}") | ||
| # Get the library's current install_name | ||
| execute_process( | ||
| COMMAND otool -D "${_lib}" | ||
| OUTPUT_VARIABLE _install_name_output | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET | ||
| ) | ||
| # Extract just the install_name (second line of output) | ||
| string(REGEX REPLACE "^[^\n]+\n(.+)$" "\\1" _current_install_name | ||
| "${_install_name_output}" | ||
| ) | ||
| get_filename_component(_lib_name "${_lib}" NAME) | ||
| # Check if install_name needs fixing (doesn't start with @ or /) | ||
| if(_current_install_name MATCHES "^[^/@]") | ||
| message( | ||
| STATUS | ||
| "Fixing install_name for ${_lib_name}: ${_current_install_name} -> @rpath/${_current_install_name}" | ||
| ) | ||
| execute_process( | ||
| COMMAND install_name_tool -id "@rpath/${_current_install_name}" | ||
| "${_lib}" ERROR_QUIET | ||
| ) | ||
marcpaterno marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| endif() | ||
| endif() | ||
| endforeach() | ||
| endif() | ||
|
|
||
| if(NOT TARGET jsonnet::lib) | ||
| add_library(jsonnet::lib SHARED IMPORTED) | ||
| set_target_properties( | ||
|
|
@@ -48,3 +80,4 @@ if(${CMAKE_FIND_PACKAGE_NAME}_FOUND) | |
| ) | ||
| endif() | ||
| endif() | ||
|
|
||
|
||
Uh oh!
There was an error while loading. Please reload this page.