summaryrefslogtreecommitdiffstats
path: root/Source/cmProjectCommand.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-06-29 11:36:28 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-06-29 11:36:28 (GMT)
commit16208ac1132b5624743c3ea534f610541d90ab8f (patch)
tree8353fc636dc18ad199666d18067ed23944ce26f2 /Source/cmProjectCommand.cxx
parent480bd71b1655e84c1197c6c48bb606c18669548f (diff)
downloadCMake-16208ac1132b5624743c3ea534f610541d90ab8f.zip
CMake-16208ac1132b5624743c3ea534f610541d90ab8f.tar.gz
CMake-16208ac1132b5624743c3ea534f610541d90ab8f.tar.bz2
CMP0126: Add control for warnings
Fixes: #22353
Diffstat (limited to 'Source/cmProjectCommand.cxx')
-rw-r--r--Source/cmProjectCommand.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index acdb09f..6950c19 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -71,7 +71,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
// CMAKE_PROJECT_NAME will match PROJECT_NAME, and cmake --build
// will work.
if (!mf.GetDefinition("CMAKE_PROJECT_NAME") || mf.IsRootMakefile()) {
- mf.AddDefinition("CMAKE_PROJECT_NAME", projectName);
+ mf.RemoveDefinition("CMAKE_PROJECT_NAME");
mf.AddCacheDefinition("CMAKE_PROJECT_NAME", projectName,
"Value Computed by CMake", cmStateEnums::STATIC);
}
@@ -395,7 +395,7 @@ static void TopLevelCMakeVarCondSet(cmMakefile& mf, std::string const& name,
// in the same CMakeLists.txt file, and it is the top level
// CMakeLists.txt file, then go with the last one.
if (!mf.GetDefinition(name) || mf.IsRootMakefile()) {
- mf.AddDefinition(name, value);
+ mf.RemoveDefinition(name);
mf.AddCacheDefinition(name, value, "Value Computed by CMake",
cmStateEnums::STATIC);
}