Merge topic 'fix-qtautogen-with-object-library-Ninja'

9bc6eb8e cmGlobalGenerator: Initialize generator targets on construction (#15729)
This commit is contained in:
Brad King 2015-09-29 10:08:13 -04:00 committed by CMake Topic Stage
commit 130f116340
5 changed files with 15 additions and 17 deletions

View File

@ -275,6 +275,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
this->LocalGenerator = lg; this->LocalGenerator = lg;
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
this->GlobalGenerator->ComputeTargetObjectDirectory(this);
CreatePropertyGeneratorExpressions( CreatePropertyGeneratorExpressions(
t->GetIncludeDirectoriesEntries(), t->GetIncludeDirectoriesEntries(),
t->GetIncludeDirectoriesBacktraces(), t->GetIncludeDirectoriesBacktraces(),

View File

@ -1263,8 +1263,6 @@ bool cmGlobalGenerator::Compute()
this->LocalGenerators[i]->AddHelperCommands(); this->LocalGenerators[i]->AddHelperCommands();
} }
this->InitGeneratorTargets();
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
for (std::vector<cmTarget const*>::iterator it = autogenTargets.begin(); for (std::vector<cmTarget const*>::iterator it = autogenTargets.begin();
it != autogenTargets.end(); ++it) it != autogenTargets.end(); ++it)
@ -1557,19 +1555,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
mf->SetGeneratorTargets(generatorTargets); mf->SetGeneratorTargets(generatorTargets);
} }
//----------------------------------------------------------------------------
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) void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
{ {

View File

@ -480,7 +480,6 @@ private:
cmGeneratorTargetsType GeneratorTargets; cmGeneratorTargetsType GeneratorTargets;
friend class cmake; friend class cmake;
void CreateGeneratorTargets(TargetTypes targetTypes, cmLocalGenerator* lg); void CreateGeneratorTargets(TargetTypes targetTypes, cmLocalGenerator* lg);
void InitGeneratorTargets();
void CreateGeneratorTargets(TargetTypes targetTypes); void CreateGeneratorTargets(TargetTypes targetTypes);
void ClearGeneratorMembers(); void ClearGeneratorMembers();

View File

@ -101,7 +101,14 @@ add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.c
) )
set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h")
set_target_properties(QtAutogen codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE) add_executable(targetObjectsTest targetObjectsTest.cpp $<TARGET_OBJECTS:privateSlot>)
target_link_libraries(targetObjectsTest ${QT_LIBRARIES})
set_target_properties(
QtAutogen codeeditorLib privateSlot targetObjectsTest
PROPERTIES
AUTOMOC TRUE
)
include(GenerateExportHeader) include(GenerateExportHeader)
# The order is relevant here. B depends on A, and B headers depend on A # The order is relevant here. B depends on A, and B headers depend on A

View File

@ -0,0 +1,5 @@
int main()
{
return 0;
}