summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-28 17:55:55 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-04-28 17:55:55 (GMT)
commit9de73d7ee51073841e0aea83096c187ea365532e (patch)
tree4373acfe7f6fbb371a6c651e78819ac3f115e959
parentc0989eaf2afeebaedfdec4d42fdeb344b867c4f8 (diff)
parent8d9f39f4c324db01d5a60c5a783e1c44180c5c4c (diff)
downloadCMake-9de73d7ee51073841e0aea83096c187ea365532e.zip
CMake-9de73d7ee51073841e0aea83096c187ea365532e.tar.gz
CMake-9de73d7ee51073841e0aea83096c187ea365532e.tar.bz2
Merge topic 'include-early-optional-handling'
8d9f39f4 include: Ask for permission, rather than forgiveness.
-rw-r--r--Source/cmIncludeCommand.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 132b650..71dabaf 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -130,8 +130,20 @@ bool cmIncludeCommand
gg->GenerateImportFile(fname_abs);
}
+ std::string listFile =
+ cmSystemTools::CollapseFullPath(fname.c_str(),
+ this->Makefile->GetCurrentSourceDirectory());
+ if(optional && !cmSystemTools::FileExists(listFile.c_str()))
+ {
+ if (!resultVarName.empty())
+ {
+ this->Makefile->AddDefinition(resultVarName, "NOTFOUND");
+ }
+ return true;
+ }
+
bool readit =
- this->Makefile->ReadDependentFile(fname.c_str(), noPolicyScope);
+ this->Makefile->ReadDependentFile(listFile.c_str(), noPolicyScope);
// add the location of the included file if a result variable was given
if (!resultVarName.empty())