Revert "CMakePM: Set platform codegen and linker flags for GCC compilers"

This reverts commit 831b93905b.

Reason for revert: breaks Android and it looks like magic. For CMake one
should use a toolchain file. But this revert keeps the CMAKE_C|
XX_FLAGS_INIT parameters update / merging.

Change-Id: I1c3c61e4a9345a29e72db7f5f5a2d6e3fdba52f1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2024-06-10 13:48:23 +00:00
committed by Eike Ziller
parent 2d35dd1532
commit b66a800045

View File

@@ -34,7 +34,6 @@
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/environmentaspectwidget.h> #include <projectexplorer/environmentaspectwidget.h>
#include <projectexplorer/environmentwidget.h> #include <projectexplorer/environmentwidget.h>
#include <projectexplorer/gcctoolchain.h>
#include <projectexplorer/kitaspects.h> #include <projectexplorer/kitaspects.h>
#include <projectexplorer/namedwidget.h> #include <projectexplorer/namedwidget.h>
#include <projectexplorer/processparameters.h> #include <projectexplorer/processparameters.h>
@@ -1184,30 +1183,6 @@ static CommandLine defaultInitialCMakeCommand(
} }
} }
// GCC compiler and linker specific flags
for (Toolchain *tc : ToolchainKitAspect::toolChains(k)) {
if (auto *gccTc = tc->asGccToolchain()) {
const QStringList compilerFlags = gccTc->platformCodeGenFlags();
QLatin1String languageFlagsInit;
if (gccTc->language() == ProjectExplorer::Constants::C_LANGUAGE_ID)
languageFlagsInit = QLatin1String(CMAKE_C_FLAGS_INIT);
else if (gccTc->language() == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
languageFlagsInit = QLatin1String(CMAKE_CXX_FLAGS_INIT);
if (!languageFlagsInit.isEmpty() && !compilerFlags.isEmpty())
cmd.addArg("-D" + languageFlagsInit + ":STRING=" + compilerFlags.join(" "));
const QStringList linkerFlags = gccTc->platformLinkerFlags();
if (!linkerFlags.isEmpty()) {
const QString joinedLinkerFlags = linkerFlags.join(" ");
cmd.addArg("-DCMAKE_EXE_LINKER_FLAGS_INIT:STRING=" + joinedLinkerFlags);
cmd.addArg("-DCMAKE_MODULE_LINKER_FLAGS_INIT:STRING=" + joinedLinkerFlags);
cmd.addArg("-DCMAKE_SHARED_LINKER_FLAGS_INIT:STRING=" + joinedLinkerFlags);
}
}
}
cmd.addArgs(CMakeConfigurationKitAspect::toArgumentsList(k)); cmd.addArgs(CMakeConfigurationKitAspect::toArgumentsList(k));
cmd.addArgs(CMakeConfigurationKitAspect::additionalConfiguration(k), CommandLine::Raw); cmd.addArgs(CMakeConfigurationKitAspect::additionalConfiguration(k), CommandLine::Raw);
@@ -1356,7 +1331,7 @@ static void addCMakeConfigurePresetToInitialArguments(QStringList &initialArgume
if (argFilePath != presetFilePath) if (argFilePath != presetFilePath)
arg = presetItem.toArgument(); arg = presetItem.toArgument();
} else if (argItem.key == CMAKE_CXX_FLAGS_INIT) { } else if (argItem.key == CMAKE_C_FLAGS_INIT || argItem.key == CMAKE_CXX_FLAGS_INIT) {
// Append the preset value with at the initial parameters value (e.g. QML Debugging) // Append the preset value with at the initial parameters value (e.g. QML Debugging)
if (argItem.expandedValue(k) != QString::fromUtf8(presetItem.value)) { if (argItem.expandedValue(k) != QString::fromUtf8(presetItem.value)) {
argItem.value.append(" "); argItem.value.append(" ");