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

Method WriteTargets

Source/cmGlobalFastbuildGenerator.cxx:1841–1885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1839}
1840
1841void cmGlobalFastbuildGenerator::WriteTargets()
1842{
1843 std::string const outputDir = this->CMakeInstance->GetHomeOutputDirectory();
1844 LogMessage("GetHomeOutputDirectory: " + outputDir);
1845 // Noop file that 'all' can alias to if we don't have any other targets...
1846 // The exact location of the "noop" file is verified in one of the tests in
1847 // "RunCMake.CMakePresetsPackage" test suite.
1848 cmSystemTools::Touch(cmStrCat(this->CMakeInstance->GetHomeOutputDirectory(),
1849 '/', FASTBUILD_NOOP_FILE_NAME),
1850 true);
1851 cmSystemTools::Touch(cmStrCat(this->CMakeInstance->GetHomeOutputDirectory(),
1852 '/', FASTBUILD_CLEAN_FILE_NAME),
1853 true);
1854 // Add "all" utility target before sorting, so we can correctly sort
1855 // targets that depend on it
1856 AddTargetAll();
1857 TopologicalSort(FastbuildTargets);
1858
1859 AddGlobCheckExec();
1860
1861 for (auto const& targetBase : FastbuildTargets) {
1862 this->WriteComment("Target definition: " + targetBase->Name);
1863 // Target start.
1864 *BuildFileStream << "{\n";
1865
1866 if (targetBase->Type == FastbuildTargetType::EXEC) {
1867 this->WriteExec(static_cast<FastbuildExecNode const&>(*targetBase));
1868 } else if (targetBase->Type == FastbuildTargetType::ALIAS) {
1869 this->WriteAlias(static_cast<FastbuildAliasNode const&>(*targetBase));
1870 } else if (targetBase->Type == FastbuildTargetType::LINK) {
1871 auto const& target = static_cast<FastbuildTarget const&>(*targetBase);
1872 this->WriteTarget(target);
1873 }
1874 // Target end.
1875 *BuildFileStream << "}\n";
1876 }
1877
1878 if (!this->GetCMakeInstance()->GetIsInTryCompile()) {
1879 if (!IDEProjects.empty()) {
1880 this->WriteIDEProjects();
1881 }
1882 }
1883 this->WriteTargetClean();
1884 this->WriteTargetRebuildBFF();
1885}
1886
1887std::string cmGlobalFastbuildGenerator::GetTargetName(
1888 cmGeneratorTarget const* GeneratorTarget) const

Callers 1

GenerateMethod · 0.95

Calls 11

WriteCommentMethod · 0.95
WriteExecMethod · 0.95
WriteAliasMethod · 0.95
WriteTargetMethod · 0.95
WriteIDEProjectsMethod · 0.95
WriteTargetCleanMethod · 0.95
WriteTargetRebuildBFFMethod · 0.95
GetIsInTryCompileMethod · 0.80
cmStrCatFunction · 0.70
GetCMakeInstanceMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected