summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-03-02 16:49:35 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-03-02 16:49:35 (GMT)
commit1073d50508aa384984b9ea6200863855237ad4a1 (patch)
treeb41d7b7c158bd939b75d6137bb9fb50daa2004c6 /Source
parent20446079eebe5cf734f673071efd0d1b56a02a61 (diff)
parent2557a080543a37f92e1908420842db8c90685304 (diff)
downloadCMake-1073d50508aa384984b9ea6200863855237ad4a1.zip
CMake-1073d50508aa384984b9ea6200863855237ad4a1.tar.gz
CMake-1073d50508aa384984b9ea6200863855237ad4a1.tar.bz2
Merge topic 'inject_code_via_variable'
2557a08 Fix typo in error message, and remove redundent test. 9090572 Add ability to include a file in a project via a cache variable.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmProjectCommand.cxx18
-rw-r--r--Source/cmProjectCommand.h5
2 files changed, 22 insertions, 1 deletions
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 6e3b6af..fcf0a49 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -77,6 +77,24 @@ bool cmProjectCommand
languages.push_back("CXX");
}
this->Makefile->EnableLanguage(languages, false);
+ std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE";
+ const char* include = this->Makefile->GetDefinition(extraInclude.c_str());
+ if(include)
+ {
+ std::string fullFilePath;
+ bool readit =
+ this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(),
+ include);
+ if(!readit && !cmSystemTools::GetFatalErrorOccured())
+ {
+ std::string m =
+ "could not find file:\n"
+ " ";
+ m += include;
+ this->SetError(m.c_str());
+ return false;
+ }
+ }
return true;
}
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index fc2b7a2..1e5fc09 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -68,7 +68,10 @@ public:
"By default C and CXX are enabled. E.g. if you do not have a "
"C++ compiler, you can disable the check for it by explicitly listing "
"the languages you want to support, e.g. C. By using the special "
- "language \"NONE\" all checks for any language can be disabled.";
+ "language \"NONE\" all checks for any language can be disabled. "
+ "If a variable exists called CMAKE_PROJECT_<projectName>_INCLUDE_FILE, "
+ "the file pointed to by that variable will be included as the last step "
+ "of the project command.";
}
cmTypeMacro(cmProjectCommand, cmCommand);