Skip to content

Commit d9490b4

Browse files
author
Paweł Andruszkiewicz
committed
Fix polyglot-related build issues
Change-Id: I16b1675069104662ceabf373c8ef9ff0aa835af9
1 parent 7fa41c7 commit d9490b4

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,10 +759,21 @@ IF (BUNDLED_POLYGLOT_DIR)
759759
FIND_LIBRARY(POLYGLOT_LIBRARY
760760
NAMES
761761
polyglot
762+
libpolyglot
762763
HINTS
763764
"${BUNDLED_POLYGLOT_DIR}"
764765
NO_DEFAULT_PATH)
765766

767+
IF(APPLE)
768+
# reset the ID to something predictible
769+
get_filename_component(POLYGLOT_LIBRARY_NAME "${POLYGLOT_LIBRARY}" NAME)
770+
EXECUTE_PROCESS(COMMAND install_name_tool -id "${POLYGLOT_LIBRARY_NAME}" "${POLYGLOT_LIBRARY}" RESULT_VARIABLE COMMAND_RESULT)
771+
772+
IF(NOT "${COMMAND_RESULT}" STREQUAL "0")
773+
MESSAGE(FATAL_ERROR "Failed to execute: install_name_tool -id ${POLYGLOT_LIBRARY_NAME} ${POLYGLOT_LIBRARY}")
774+
ENDIF()
775+
ENDIF()
776+
766777
INCLUDE_DIRECTORIES(SYSTEM "${BUNDLED_POLYGLOT_DIR}")
767778
MESSAGE(STATUS "Polyglot Library: ${POLYGLOT_LIBRARY}")
768779
SET(HAVE_JS 1)

cmake/exeutils.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ function(add_shell_executable)
8989
"${ANTLR4_LIB_FILENAME}" "@loader_path/../${INSTALL_LIBDIR}/${ANTLR4_LIB_FILENAME}"
9090
$<TARGET_FILE:${ARGV0}>)
9191
endif()
92+
if(BUNDLED_POLYGLOT_DIR)
93+
add_custom_command(TARGET "${ARGV0}" POST_BUILD
94+
COMMAND install_name_tool -change
95+
"${POLYGLOT_LIBRARY_NAME}" "@loader_path/../${INSTALL_LIBDIR}/${POLYGLOT_LIBRARY_NAME}"
96+
$<TARGET_FILE:${ARGV0}>
97+
)
98+
endif()
9299
elseif(NOT WIN32)
93100
if(BUNDLED_OPENSSL OR BUNDLED_SHARED_PYTHON OR BUNDLED_SSH_DIR OR BUNDLED_KRB5_DIR OR BUNDLED_ANTLR_DIR OR BUNDLED_SASL_DIR)
94101
# newer versions of linker enable new dtags by default, causing -Wl,-rpath to create RUNPATH

0 commit comments

Comments
 (0)