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

Method AppendTarget

Source/cmExtraCodeBlocksGenerator.cxx:485–625  ·  view source on GitHub ↗

Generate the xml code for one target.

Source from the content-addressed store, hash-verified

483
484// Generate the xml code for one target.
485void cmExtraCodeBlocksGenerator::AppendTarget(
486 cmXMLWriter& xml, std::string const& targetName, cmGeneratorTarget* target,
487 std::string const& make, cmLocalGenerator const* lg,
488 std::string const& compiler, std::string const& makeFlags)
489{
490 cmMakefile const* makefile = lg->GetMakefile();
491 std::string makefileName =
492 cmStrCat(lg->GetCurrentBinaryDirectory(), "/Makefile");
493
494 xml.StartElement("Target");
495 xml.Attribute("title", targetName);
496
497 if (target) {
498 int cbTargetType = this->GetCBTargetType(target);
499 std::string workingDir = lg->GetCurrentBinaryDirectory();
500 if (target->GetType() == cmStateEnums::EXECUTABLE) {
501 // Determine the directory where the executable target is created, and
502 // set the working directory to this dir.
503 cmValue runtimeOutputDir =
504 makefile->GetDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY");
505 if (runtimeOutputDir) {
506 workingDir = *runtimeOutputDir;
507 } else {
508 cmValue executableOutputDir =
509 makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
510 if (executableOutputDir) {
511 workingDir = *executableOutputDir;
512 }
513 }
514 }
515
516 std::string buildType = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
517 std::string location;
518 if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
519 location = this->CreateDummyTargetFile(target);
520 } else {
521 location = target->GetLocation(buildType);
522 }
523
524 xml.StartElement("Option");
525 xml.Attribute("output", location);
526 xml.Attribute("prefix_auto", 0);
527 xml.Attribute("extension_auto", 0);
528 xml.EndElement();
529
530 xml.StartElement("Option");
531 xml.Attribute("working_dir", workingDir);
532 xml.EndElement();
533
534 xml.StartElement("Option");
535 xml.Attribute("object_output", "./");
536 xml.EndElement();
537
538 xml.StartElement("Option");
539 xml.Attribute("type", cbTargetType);
540 xml.EndElement();
541
542 xml.StartElement("Option");

Callers 1

CreateNewProjectFileMethod · 0.95

Calls 15

GetCBTargetTypeMethod · 0.95
CreateDummyTargetFileMethod · 0.95
BuildMakeCommandMethod · 0.95
appendFunction · 0.85
cmRemoveDuplicatesFunction · 0.85
cmMakeRangeFunction · 0.85
AttributeMethod · 0.80
GetCompileDefinitionsMethod · 0.80
cbeginMethod · 0.80
cmStrCatFunction · 0.70
GetMakefileMethod · 0.45
StartElementMethod · 0.45

Tested by

no test coverage detected