diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-02-13 17:21:32 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-02-14 12:11:03 +0000 |
commit | 6945dfb657a17fd66fd547e086c6fa9c76f06074 (patch) | |
tree | d24c57b30f95e35066f137594003de3806d900a2 | |
parent | 676a89fcfc2190ffa50bcb4f011ca4a96a9dd653 (diff) |
Fix MACOSX_DEPLOYMENT_TARGET being set by distutils.spawn()
Even though a user might specify a
CMAKE_OSX_DEPLOYMENT_TARGET value, this will not automatically
set the regular MACOSX_DEPLOYMENT_TARGET environment variable,
which is picked up by the compiler to decide which standard
library to use. Because CMake is invoked via run_process ->
distutils.spawn(), spawn might decide to set its own value
of MACOSX_DEPLOYMENT_TARGET. That is undesirable.
Make sure to always specify the environment variable based on
given value, or current OS version.
Change-Id: I7f2dcc546c447d30fc1585cda220e3437cee9491
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | setup.py | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1004,9 +1004,20 @@ class pyside_build(_build): latest_sdk_path = latest_sdk_path[0] cmake_cmd.append("-DCMAKE_OSX_SYSROOT={0}".format(latest_sdk_path)) + # If no explicit minimum deployment target is set, then use the current build OS + # version. Otherwise use the given version. + # This is required so that calling run_process -> distutils.spawn() does not + # set its own minimum deployment target environment variable, + # based on the python interpreter sysconfig value. Doing so could break the + # detected clang include paths for example. + current_os_version, _, _ = platform.mac_ver() + current_os_version = '.'.join(current_os_version.split('.')[:2]) + deployment_target = current_os_version if OPTION_OSX_DEPLOYMENT_TARGET: cmake_cmd.append("-DCMAKE_OSX_DEPLOYMENT_TARGET={0}" .format(OPTION_OSX_DEPLOYMENT_TARGET)) + deployment_target = OPTION_OSX_DEPLOYMENT_TARGET + os.environ['MACOSX_DEPLOYMENT_TARGET'] = deployment_target if not OPTION_SKIP_CMAKE: log.info("Configuring module %s (%s)..." % (extension, module_src_dir)) |