diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index f62d8bdac..627789f7c 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -48,6 +48,14 @@ bool cmProjectCommand::InitialPass(std::vector const& args) m_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(!m_Makefile->GetDefinition("CMAKE_PROJECT_NAME")) + { + m_Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str()); + } + std::vector languages; if(args.size() > 1) {