From 9bb014dcd9f432edb0ca2061f21bc5ac823ff6e7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 16 Aug 2024 17:13:05 +1000 Subject: [PATCH] CMake: library path reference for PLATFORM_ENV_BUILD unix/macos (#2) Correct fix from [0]. The previous fix seemed to work but on further testing the environment wasn't properly expanded. Using "$$" prefix resolves the problem. [0]: b0ec4bba70885ca13fc8bd125fcdbad875a52090 Pull Request: https://projects.blender.org/blender/blender/pulls/126395 --- build_files/cmake/platform/platform_apple.cmake | 5 +++-- build_files/cmake/platform/platform_unix.cmake | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index 95cf2562faf..1dbc4034e35 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -533,8 +533,9 @@ if(PLATFORM_BUNDLED_LIBRARIES) # Environment variables to run precompiled executables that needed libraries. list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths) - set(PLATFORM_ENV_BUILD "DYLD_LIBRARY_PATH=\"${_library_paths};\$DYLD_LIBRARY_PATH\"") - set(PLATFORM_ENV_INSTALL "DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/Blender.app/Contents/Resources/lib/;$DYLD_LIBRARY_PATH") + # Intentionally double "$$" which expands into "$" when instantiated. + set(PLATFORM_ENV_BUILD "DYLD_LIBRARY_PATH=\"${_library_paths};$$DYLD_LIBRARY_PATH\"") + set(PLATFORM_ENV_INSTALL "DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/Blender.app/Contents/Resources/lib/;$$DYLD_LIBRARY_PATH") unset(_library_paths) endif() diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index c2fea4c4f88..fcd804995ac 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -1145,11 +1145,12 @@ if(PLATFORM_BUNDLED_LIBRARIES) # Environment variables to run precompiled executables that needed libraries. list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths) + # Intentionally double "$$" which expands into "$" when instantiated. set(PLATFORM_ENV_BUILD - "LD_LIBRARY_PATH=\"${_library_paths}:\$LD_LIBRARY_PATH\"" + "LD_LIBRARY_PATH=\"${_library_paths}:$$LD_LIBRARY_PATH\"" ) set(PLATFORM_ENV_INSTALL - "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib/;\$LD_LIBRARY_PATH" + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib/;$$LD_LIBRARY_PATH" ) unset(_library_paths) else()