summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-03-26 13:47:22 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-03-26 13:47:29 (GMT)
commit18a2e863852e6b9f918940698952b75e5e17dcd8 (patch)
treed9d81e798525c4cd12058895a63ca7651ae4f3fb /Source
parente0c3b9268b0e45010c405cfc69bbaf1410fbd3eb (diff)
parent96a704010713833e9ec17fa78495df3e0852bbf5 (diff)
downloadCMake-18a2e863852e6b9f918940698952b75e5e17dcd8.zip
CMake-18a2e863852e6b9f918940698952b75e5e17dcd8.tar.gz
CMake-18a2e863852e6b9f918940698952b75e5e17dcd8.tar.bz2
Merge topic 'project-is-top-level'
96a7040107 project: Define variables indicating whether project is top level 3706e9c97c Help: Convert project() directory variables to a definition list Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Michael Hirsch <michael@scivision.dev> Merge-request: !5938
Diffstat (limited to 'Source')
-rw-r--r--Source/cmProjectCommand.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index ed32de9..acdb09f 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -59,6 +59,11 @@ bool cmProjectCommand(std::vector<std::string> const& args,
mf.AddDefinition("PROJECT_NAME", projectName);
+ mf.AddDefinitionBool("PROJECT_IS_TOP_LEVEL", mf.IsRootMakefile());
+ mf.AddCacheDefinition(projectName + "_IS_TOP_LEVEL",
+ mf.IsRootMakefile() ? "ON" : "OFF",
+ "Value Computed by CMake", cmStateEnums::STATIC);
+
// Set the CMAKE_PROJECT_NAME variable to be the highest-level
// project name in the tree. If there are two project commands
// in the same CMakeLists.txt file, and it is the top level