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

Method AddSubDirectory

Source/cmMakefile.cxx:1738–1783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1736}
1737
1738void cmMakefile::AddSubDirectory(std::string const& srcPath,
1739 std::string const& binPath,
1740 bool excludeFromAll, bool immediate,
1741 bool system)
1742{
1743 if (this->DeferRunning) {
1744 this->IssueMessage(
1745 MessageType::FATAL_ERROR,
1746 "Subdirectories may not be created during deferred execution.");
1747 return;
1748 }
1749
1750 // Make sure the binary directory is unique.
1751 if (!this->EnforceUniqueDir(srcPath, binPath)) {
1752 return;
1753 }
1754
1755 cmStateSnapshot newSnapshot =
1756 this->GetState()->CreateBuildsystemDirectorySnapshot(this->StateSnapshot);
1757
1758 newSnapshot.GetDirectory().SetCurrentSource(srcPath);
1759 newSnapshot.GetDirectory().SetCurrentBinary(binPath);
1760
1761 cmSystemTools::MakeDirectory(binPath);
1762
1763 auto subMfu =
1764 cm::make_unique<cmMakefile>(this->GlobalGenerator, newSnapshot);
1765 auto* subMf = subMfu.get();
1766 this->GetGlobalGenerator()->AddMakefile(std::move(subMfu));
1767
1768 if (excludeFromAll) {
1769 subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
1770 }
1771 if (system) {
1772 subMf->SetProperty("SYSTEM", "TRUE");
1773 }
1774
1775 if (immediate) {
1776 this->ConfigureSubDirectory(subMf);
1777 } else {
1778 this->UnConfiguredDirectories.push_back(subMf);
1779 }
1780
1781 this->AddInstallGenerator(cm::make_unique<cmInstallSubdirectoryGenerator>(
1782 subMf, binPath, this->GetBacktrace()));
1783}
1784
1785std::string const& cmMakefile::GetCurrentSourceDirectory() const
1786{

Callers 2

cmAddSubDirectoryCommandFunction · 0.80
cmSubdirCommandFunction · 0.80

Calls 15

IssueMessageMethod · 0.95
EnforceUniqueDirMethod · 0.95
GetStateMethod · 0.95
GetGlobalGeneratorMethod · 0.95
ConfigureSubDirectoryMethod · 0.95
AddInstallGeneratorMethod · 0.95
GetBacktraceMethod · 0.95
moveFunction · 0.85
SetCurrentSourceMethod · 0.80
SetCurrentBinaryMethod · 0.80
AddMakefileMethod · 0.80

Tested by

no test coverage detected