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