forked from qt-creator/qt-creator
ProjectExplorer: Fix Clang toolchain setup on Windows
Clang toolchain in gcc mode requires mingw sysroot and target in order to be used properly on Windows. Requires Qt >= 5.12 to work properly (it has the required mkspec). Change-Id: I4e5a734c699ac98740c0d50560aa7b69751ae58c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectmacroexpander.h>
|
||||
@@ -500,6 +501,18 @@ CMakeBuildInfo *CMakeBuildConfigurationFactory::createBuildInfo(const ProjectExp
|
||||
if (!buildTypeItem.isNull())
|
||||
info->configuration.append(buildTypeItem);
|
||||
|
||||
const QString sysRoot = SysRootKitInformation::sysRoot(k).toString();
|
||||
if (!sysRoot.isEmpty()) {
|
||||
info->configuration.append(CMakeConfigItem("CMAKE_SYSROOT", sysRoot.toUtf8()));
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(
|
||||
k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
if (tc) {
|
||||
const QByteArray targetTriple = tc->originalTargetTriple().toUtf8();
|
||||
info->configuration.append(CMakeConfigItem("CMAKE_C_COMPILER_TARGET", targetTriple));
|
||||
info->configuration.append(CMakeConfigItem("CMAKE_CXX_COMPILER_TARGET ", targetTriple));
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user