diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-21 11:33:16 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-21 12:26:52 +0200 |
commit | ff3a9f61edc479e5610f6d57c5ab789704ca81cb (patch) | |
tree | 5ef1cda4d39a17b8f14deb815e058261c60abc82 /sources | |
parent | afc3ba9023e7eae7a9df36932f68f5b66f120fcd (diff) |
Fix propagation of existing LD env vars when calling generate_pyi
Existing PATH, LD_LIBRARIES_PATH or DYLD_LIBRARY_PATH values should be
appended to the ones we set ourselves. This takes care of finding any
system libraries which a distro / OS might set by default.
Change-Id: I1b3d1ea20c024e8ffcba3fb38d9088917130abfe
Fixes: PYSIDE-1008
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/pyside2/cmake/Macros/PySideModules.cmake | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake index 67d27cb81..dca00ec11 100644 --- a/sources/pyside2/cmake/Macros/PySideModules.cmake +++ b/sources/pyside2/cmake/Macros/PySideModules.cmake @@ -162,25 +162,36 @@ macro(create_pyside_module) # Need to set the LD_ env vars before invoking the script, because it might use build-time # libraries instead of install time libraries. if (WIN32) - set(ld_prefix "PATH=") + set(ld_prefix_var_name "PATH") elseif(APPLE) - set(ld_prefix "DYLD_LIBRARY_PATH=") + set(ld_prefix_var_name "DYLD_LIBRARY_PATH") else() - set(ld_prefix "LD_LIBRARY_PATH=") + set(ld_prefix_var_name "LD_LIBRARY_PATH") endif() - set(ld_prefix "${ld_prefix}${pysidebindings_BINARY_DIR}/libpyside${PATH_SEP}${SHIBOKEN_SHARED_LIBRARY_DIR}") + set(ld_prefix "${ld_prefix_var_name}=${pysidebindings_BINARY_DIR}/libpyside${PATH_SEP}${SHIBOKEN_SHARED_LIBRARY_DIR}") - # On Windows we also need to propagate the whole environment PATH value, because pyside modules - # import Qt, and the Qt modules are found from PATH. + # Append any existing ld_prefix values, so existing PATH, LD_LIBRARY_PATH, etc. + # On Windows it is needed because pyside modules import Qt, + # and the Qt modules are found from PATH. + # On Linux and macOS, existing values might be set to find system libraries correctly. + # For example on openSUSE when compiling with icc, libimf.so from Intel has to be found. if(WIN32) # Get the value of PATH with CMake separators. - file(TO_CMAKE_PATH "$ENV{PATH}" path_value) + file(TO_CMAKE_PATH "$ENV{${ld_prefix_var_name}}" path_value) # Replace the CMake list separators with "\;"s, to avoid the PATH values being # interpreted as CMake list elements, we actually want to pass the whole string separated # by ";" to the command line. - make_path(path_value "${path_value}") - string(APPEND ld_prefix "${PATH_SEP}${path_value}") + if(path_value) + make_path(path_value "${path_value}") + string(APPEND ld_prefix "${PATH_SEP}${path_value}") + endif() + else() + # Handles both macOS and Linux. + set(env_value "$ENV{${ld_prefix_var_name}}") + if(env_value) + string(APPEND ld_prefix ":${env_value}") + endif() endif() set(generate_pyi_options ${module_NAME} --sys-path "${pysidebindings_BINARY_DIR}" |