From b40b5cb79c1f8b4289fcc6ca779cc40ea5d546e0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 13 Aug 2018 09:01:53 +0200 Subject: [PATCH] Fix Botan build on macOS Since some Xcode version, running clang directly from the Toolchains directory requires explicitly passing the sysroot to use. If that is not done, inclusion of some standard headers like string.h fails. Change-Id: I640eca41d4132354f1091a7514586cb582e5d05c Reviewed-by: Eike Ziller Reviewed-by: Christian Stenger --- src/libs/botan/botan.pro | 2 +- src/libs/botan/botan.qbs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libs/botan/botan.pro b/src/libs/botan/botan.pro index 04feb8d3292..48b3b2ea359 100644 --- a/src/libs/botan/botan.pro +++ b/src/libs/botan/botan.pro @@ -30,7 +30,7 @@ mingw { BOTAN_CXX_FLAGS = msvc: BOTAN_CXX_FLAGS += /wd4127 /wd4244 /wd4250 /wd4267 /wd4334 /wd4702 /wd4996 else: BOTAN_CXX_FLAGS += -Wno-unused-parameter -macos: BOTAN_CXX_FLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET +macos: BOTAN_CXX_FLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET -isysroot $$shell_quote($$QMAKE_MAC_SDK.macosx.Path) unix: BOTAN_CXX_FLAGS += -fPIC !isEmpty(BOTAN_CXX_FLAGS): OTHER_FLAGS += --cxxflags=$$shell_quote($$BOTAN_CXX_FLAGS) win32: OTHER_FLAGS += --link-method=hardlink diff --git a/src/libs/botan/botan.qbs b/src/libs/botan/botan.qbs index 04acfad0484..3872e900adb 100644 --- a/src/libs/botan/botan.qbs +++ b/src/libs/botan/botan.qbs @@ -6,6 +6,7 @@ Product { type: ["staticlibrary", "hpp"] Depends { name: "cpp" } Depends { name: "qtc" } + Depends { name: "xcode"; condition: qbs.toolchain.contains("xcode") } files: "update-botan.sh" Group { name: "Botan sources" @@ -47,8 +48,11 @@ Product { } else if (product.qbs.toolchain.contains("gcc")) cxxFlags.push("-Wno-unused-parameter"); - if (product.qbs.targetOS.contains("macos")) + if (product.qbs.targetOS.contains("macos")) { cxxFlags.push("-mmacosx-version-min=" + project.minimumMacosVersion); + if (product.qbs.toolchain.contains("xcode")) + cxxFlags.push("-isysroot", product.xcode.sdkPath); + } if (product.qbs.targetOS.contains("unix")) cxxFlags.push("-fPIC"); if (cxxFlags.length > 0)