MCPcopy Create free account
hub / github.com/Kitware/CMake / GetOrCreateGlobalTarget

Method GetOrCreateGlobalTarget

Source/cmQtAutoGenGlobalInitializer.cxx:164–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162cmQtAutoGenGlobalInitializer::~cmQtAutoGenGlobalInitializer() = default;
163
164void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget(
165 cmLocalGenerator* localGen, std::string const& name,
166 std::string const& comment)
167{
168 // Test if the target already exists
169 if (!localGen->FindGeneratorTargetToUse(name)) {
170 cmMakefile const* makefile = localGen->GetMakefile();
171
172 // Create utility target
173 auto cc = cm::make_unique<cmCustomCommand>();
174 cc->SetWorkingDirectory(makefile->GetHomeOutputDirectory().c_str());
175 cc->SetEscapeOldStyle(false);
176 cc->SetComment(comment.c_str());
177 cmTarget* target = localGen->AddUtilityCommand(name, true, std::move(cc));
178 localGen->AddGeneratorTarget(
179 cm::make_unique<cmGeneratorTarget>(target, localGen));
180
181 // Set FOLDER property in the target
182 {
183 cmValue folder =
184 makefile->GetState()->GetGlobalProperty("AUTOGEN_TARGETS_FOLDER");
185 if (folder) {
186 target->SetProperty("FOLDER", folder);
187 }
188 }
189 }
190}
191
192void cmQtAutoGenGlobalInitializer::AddToGlobalAutoGen(
193 cmLocalGenerator* localGen, std::string const& targetName)

Callers 1

Calls 12

moveFunction · 0.85
c_strMethod · 0.80
SetEscapeOldStyleMethod · 0.80
AddGeneratorTargetMethod · 0.80
GetGlobalPropertyMethod · 0.80
GetMakefileMethod · 0.45
SetWorkingDirectoryMethod · 0.45
SetCommentMethod · 0.45
AddUtilityCommandMethod · 0.45
GetStateMethod · 0.45
SetPropertyMethod · 0.45

Tested by

no test coverage detected