mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Autogen: Enable depfile support for Visual Studio and Xcode generators
Extend the depfile-based AUTOGEN incremental build support to Visual Studio and Xcode generators, in addition to the existing Ninja and Makefile support. Use generator name matching rather than SupportsCustomCommandDepfile() to select generators explicitly, because not all generators that claim depfile support handle the resulting build graph correctly. In particular, when depfiles are used, CMake introduces a _autogen_timestamp_deps utility target to express ordering constraints, and the FASTBuild generator does not correctly propagate dependencies through utility targets that have no commands, breaking the build when generated files are AUTOMOC inputs. When depfiles are used, disable the PRE_BUILD optimization for Visual Studio because PRE_BUILD events cannot carry depfile dependencies. Fixes: #25233 Fixes: #25234
This commit is contained in:
@@ -1372,7 +1372,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
auto const& gen = this->GlobalGen->GetName();
|
||||
return this->QtVersion >= IntegerVersion(5, 15) &&
|
||||
(gen.find("Ninja") != std::string::npos ||
|
||||
gen.find("Make") != std::string::npos);
|
||||
gen.find("Make") != std::string::npos ||
|
||||
gen.find("Visual Studio") != std::string::npos || gen == "Xcode");
|
||||
}();
|
||||
|
||||
// Files provided by the autogen target
|
||||
@@ -1453,6 +1454,10 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
if (this->AutogenTarget.GlobalTarget) {
|
||||
usePRE_BUILD = false;
|
||||
}
|
||||
// Cannot use PRE_BUILD with depfiles
|
||||
if (useDepfile) {
|
||||
usePRE_BUILD = false;
|
||||
}
|
||||
}
|
||||
// Create the autogen target/command
|
||||
if (usePRE_BUILD) {
|
||||
|
||||
Reference in New Issue
Block a user