summaryrefslogtreecommitdiffstats
path: root/Source/cmProjectCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-01-29 14:28:01 (GMT)
committerBrad King <brad.king@kitware.com>2014-01-29 14:40:51 (GMT)
commit16d040c958c68c38b2c0642b4094245af28c1910 (patch)
treec91d9e31022776c5682cd6fe7a673721bd6186b2 /Source/cmProjectCommand.cxx
parent00007dcc365797f71ebba2c7d31ab20abc4019e6 (diff)
downloadCMake-16d040c958c68c38b2c0642b4094245af28c1910.zip
CMake-16d040c958c68c38b2c0642b4094245af28c1910.tar.gz
CMake-16d040c958c68c38b2c0642b4094245af28c1910.tar.bz2
project: Add optional LANGUAGES keyword
Teach the project() command to recognize an optional "LANGUAGES" keyword after the project name and prior to the list of languages. Do not allow multiple copies of the keyword. If the keyword is specified and no languages are listed, imply NONE.
Diffstat (limited to 'Source/cmProjectCommand.cxx')
-rw-r--r--Source/cmProjectCommand.cxx24
1 files changed, 21 insertions, 3 deletions
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 11f9a76..1dcb72b 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -62,15 +62,33 @@ bool cmProjectCommand
"Value Computed by CMake", cmCacheManager::STATIC);
}
+ bool haveLanguages = false;
std::vector<std::string> languages;
- if(args.size() > 1)
+ for(size_t i = 1; i < args.size(); ++i)
{
- for(size_t i =1; i < args.size(); ++i)
+ if(args[i] == "LANGUAGES")
+ {
+ if(haveLanguages)
+ {
+ this->Makefile->IssueMessage
+ (cmake::FATAL_ERROR, "LANGUAGES may be specified at most once.");
+ cmSystemTools::SetFatalErrorOccured();
+ return true;
+ }
+ haveLanguages = true;
+ }
+ else
{
languages.push_back(args[i]);
}
}
- else
+
+ if (haveLanguages && languages.empty())
+ {
+ languages.push_back("NONE");
+ }
+
+ if (languages.empty())
{
// if no language is specified do c and c++
languages.push_back("C");