| 1736 | } |
| 1737 | |
| 1738 | void 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 | |
| 1785 | std::string const& cmMakefile::GetCurrentSourceDirectory() const |
| 1786 | { |
no test coverage detected