diff options
author | Brad King <brad.king@kitware.com> | 2015-04-28 17:55:55 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-28 17:55:55 (GMT) |
commit | 9de73d7ee51073841e0aea83096c187ea365532e (patch) | |
tree | 4373acfe7f6fbb371a6c651e78819ac3f115e959 | |
parent | c0989eaf2afeebaedfdec4d42fdeb344b867c4f8 (diff) | |
parent | 8d9f39f4c324db01d5a60c5a783e1c44180c5c4c (diff) | |
download | CMake-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.cxx | 14 |
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()) |