diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-09-26 17:48:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-09-29 13:56:34 (GMT) |
commit | 9bc6eb8e1f50d50bcbcf5b95f7121c31eb10abf2 (patch) | |
tree | d2965fb55b7341a37e58ba020ac084d4a3eb9daa /Source/cmGlobalGenerator.cxx | |
parent | 1fe390201df041cebcfcb5e6cc401f8ece2d6072 (diff) | |
download | CMake-9bc6eb8e1f50d50bcbcf5b95f7121c31eb10abf2.zip CMake-9bc6eb8e1f50d50bcbcf5b95f7121c31eb10abf2.tar.gz CMake-9bc6eb8e1f50d50bcbcf5b95f7121c31eb10abf2.tar.bz2 |
cmGlobalGenerator: Initialize generator targets on construction (#15729)
The Ninja generator and Visual Studio generators are special-cased for the
QtAutogen feature. In order to reduce the number of custom targets, the Visual
Studio generators prefer to create custom commands instead, and in order to
create appropriate Ninja files, generated rcc files are listed as byproducts.
This requires the use of the GetConfigCommonSourceFiles API of the
cmGeneratorTarget for those generators when initializing the autogen target.
The initializer method is called from Compute() after the cmGeneratorTarget
objects are created, however the initialization of the object directory occurs
later in the InitGeneratorTargets method. That means that the resulting object
locations are computed incorrectly and cached before the object directory is
determined, so the generated buildsystem can not find the object files.
The initialization of the object directory was split from the creation of
cmGeneratorTarget instances in commit 0e0258c8 (cmGlobalGenerator: Split
creation of generator object from initialization., 2015-07-25). The motivation
for the split was to do only what is essential to do early in cases where
cmGeneratorTargets need to be created at configure-time. That is required for
the purpose of implementing policies CMP0024 and CMP0026, and for
try_compile(LINK_LIBRARIES). However, the split was not really necessary.
Compute the object directory in the cmGeneratorTarget constructor instead.
The QtAutogen unit test already tests the use of TARGET_OBJECTS with AUTOMOC,
and that test already passes on Ninja. The reason it already passes is that
the QtAutogen target also uses the AUTORCC feature, and specifies several qrc
files in its SOURCES. Later in the Compute algorithm (after the
InitGeneratorTargets call), the rcc files are determined and target->AddSource
is called. The AddSource call clears the previously mentioned cache of source
files, causing it to be regenerated when next queried, this time taking account
of the object directory.
Extend the test suite with a new target which does not make use of AUTORCC with
qrc files so that the test added alone would break without the fix in this
commit.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 540bd01..4a48b5d 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1263,8 +1263,6 @@ bool cmGlobalGenerator::Compute() this->LocalGenerators[i]->AddHelperCommands(); } - this->InitGeneratorTargets(); - #ifdef CMAKE_BUILD_WITH_CMAKE for (std::vector<cmTarget const*>::iterator it = autogenTargets.begin(); it != autogenTargets.end(); ++it) @@ -1558,19 +1556,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes, } //---------------------------------------------------------------------------- -void cmGlobalGenerator::InitGeneratorTargets() -{ - for(cmGeneratorTargetsType::iterator ti = - this->GeneratorTargets.begin(); ti != this->GeneratorTargets.end(); ++ti) - { - if (!ti->second->Target->IsImported()) - { - this->ComputeTargetObjectDirectory(ti->second); - } - } -} - -//---------------------------------------------------------------------------- void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes) { // Construct per-target generator information. |