1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmProjectCommand.cxx,v $
6 Date: $Date: 2008-10-15 17:56:06 $
7 Version: $Revision: 1.26 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmProjectCommand.h"
21 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
25 this->SetError("PROJECT called with incorrect number of arguments");
28 this->Makefile
->SetProjectName(args
[0].c_str());
30 std::string bindir
= args
[0];
31 bindir
+= "_BINARY_DIR";
32 std::string srcdir
= args
[0];
33 srcdir
+= "_SOURCE_DIR";
35 this->Makefile
->AddCacheDefinition
37 this->Makefile
->GetCurrentOutputDirectory(),
38 "Value Computed by CMake", cmCacheManager::STATIC
);
39 this->Makefile
->AddCacheDefinition
41 this->Makefile
->GetCurrentDirectory(),
42 "Value Computed by CMake", cmCacheManager::STATIC
);
44 bindir
= "PROJECT_BINARY_DIR";
45 srcdir
= "PROJECT_SOURCE_DIR";
47 this->Makefile
->AddDefinition(bindir
.c_str(),
48 this->Makefile
->GetCurrentOutputDirectory());
49 this->Makefile
->AddDefinition(srcdir
.c_str(),
50 this->Makefile
->GetCurrentDirectory());
52 this->Makefile
->AddDefinition("PROJECT_NAME", args
[0].c_str());
54 // Set the CMAKE_PROJECT_NAME variable to be the highest-level
55 // project name in the tree. This is always the first PROJECT
56 // command encountered.
57 if(!this->Makefile
->GetDefinition("CMAKE_PROJECT_NAME"))
59 this->Makefile
->AddDefinition("CMAKE_PROJECT_NAME", args
[0].c_str());
60 this->Makefile
->AddCacheDefinition
61 ("CMAKE_PROJECT_NAME",
63 "Value Computed by CMake", cmCacheManager::STATIC
);
66 std::vector
<std::string
> languages
;
69 for(size_t i
=1; i
< args
.size(); ++i
)
71 languages
.push_back(args
[i
]);
76 // if no language is specified do c and c++
77 languages
.push_back("C");
78 languages
.push_back("CXX");
80 this->Makefile
->EnableLanguage(languages
, false);