diff options
Diffstat (limited to 'Source/cmProjectCommand.cxx')
-rw-r--r-- | Source/cmProjectCommand.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 1a831d9..6e3b6af 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -47,9 +47,13 @@ bool cmProjectCommand this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str()); // Set the CMAKE_PROJECT_NAME variable to be the highest-level - // project name in the tree. This is always the first PROJECT - // command encountered. - if(!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME")) + // project name in the tree. If there are two project commands + // in the same CMakeLists.txt file, and it is the top level + // CMakeLists.txt file, then go with the last one, so that + // CMAKE_PROJECT_NAME will match PROJECT_NAME, and cmake --build + // will work. + if(!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME") + || (this->Makefile->GetLocalGenerator()->GetParent() == 0) ) { this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str()); this->Makefile->AddCacheDefinition |