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]: b0ec4bba70

Pull Request: https://projects.blender.org/blender/blender/pulls/126395
This commit is contained in:
Campbell Barton
2024-08-16 17:13:05 +10:00
committed by Gitea
parent 323f88c0db
commit 9bb014dcd9
2 changed files with 6 additions and 4 deletions
@@ -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()
@@ -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()