From 3ee37ddd84a40e543f30b4a33efc728b9979f709 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 13 Feb 2018 17:21:32 +0100 Subject: 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. (cherry picked from commit 6945dfb657a17fd66fd547e086c6fa9c76f06074) Change-Id: I7f2dcc546c447d30fc1585cda220e3437cee9491 Reviewed-by: Friedemann Kleint --- setup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/setup.py b/setup.py index 81e026c6a..3bb9699b6 100644 --- a/setup.py +++ b/setup.py @@ -977,9 +977,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)) -- cgit v1.2.3