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
This commit is contained in:
Campbell Barton
2024-08-16 17:13:05 +10:00
parent a2d6808a7a
commit 6e823d3f6f
2 changed files with 6 additions and 4 deletions

View File

@@ -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()

View File

@@ -1149,11 +1149,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()