Skip to content

Commit

Permalink
Add SDK usr/lib to LIBRARY_PATH on Mac for Tcl
Browse files Browse the repository at this point in the history
Initial clone is failing on an in-build-dir checkout, unable to compile
because it can't find the System lib.
  • Loading branch information
starseeker committed Aug 14, 2024
1 parent 50de308 commit aa836fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tcl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ if (ENABLE_TCL)
# succeed
if (APPLE)
set(RPATH_CMD "COMMAND;install_name_tool;-add_rpath;@executable_path/../${LIB_DIR};${CMAKE_BUNDLE_INSTALL_PREFIX}/${BIN_DIR}/tclsh${TCL_VERSION}${CMAKE_EXECUTABLE_SUFFIX}")
# Apparently LIBRARY_PATH is sometimes needed on Mac - see
# https://stackoverflow.com/a/70676858
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path OUTPUT_VARIABLE SDKROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
endif (APPLE)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tcl_configure.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/tcl_configure.cmake @ONLY)
Expand Down
4 changes: 4 additions & 0 deletions tcl/tcl_configure.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
if (NOT WIN32)
if(APPLE)
# https://stackoverflow.com/a/70676858
set(ENV{LIBRARY_PATH} "@SDKROOT@/usr/lib")
endif(APPLE)
set(ENV{LD_LIBRARY_PATH} "@CMAKE_BUNDLE_INSTALL_PREFIX@/@LIB_DIR@")
set(ENV{CPPFLAGS} "-I@CMAKE_BUNDLE_INSTALL_PREFIX@/@INCLUDE_DIR@")
set(ENV{LDFLAGS} "-L@CMAKE_BUNDLE_INSTALL_PREFIX@/@LIB_DIR@")
Expand Down

0 comments on commit aa836fc

Please sign in to comment.