"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Source/cmIncludeCommand.cxx" between
cmake-3.13.4.tar.gz and cmake-3.14.0-rc1.tar.gz

About: CMake is a cross-platform build system designed to build, test and package software. Release candidate.

cmIncludeCommand.cxx  (cmake-3.13.4):cmIncludeCommand.cxx  (cmake-3.14.0-rc1)
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */ file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIncludeCommand.h" #include "cmIncludeCommand.h"
#include <sstream> #include <sstream>
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h" #include "cmPolicies.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmake.h"
class cmExecutionStatus; class cmExecutionStatus;
// cmIncludeCommand // cmIncludeCommand
bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args, bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&) cmExecutionStatus&)
{ {
if (args.empty() || args.size() > 4) { if (args.empty() || args.size() > 4) {
this->SetError("called with wrong number of arguments. " this->SetError("called with wrong number of arguments. "
"include() only takes one file."); "include() only takes one file.");
skipping to change at line 61 skipping to change at line 61
// parameter was ignored if it wasn't "OPTIONAL" // parameter was ignored if it wasn't "OPTIONAL"
{ {
std::string errorText = "called with invalid argument: "; std::string errorText = "called with invalid argument: ";
errorText += args[i]; errorText += args[i];
this->SetError(errorText); this->SetError(errorText);
return false; return false;
} }
} }
if (fname.empty()) { if (fname.empty()) {
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING,
"include() given empty file name (ignored)."); "include() given empty file name (ignored).");
return true; return true;
} }
if (!cmSystemTools::FileIsFullPath(fname)) { if (!cmSystemTools::FileIsFullPath(fname)) {
// Not a path. Maybe module. // Not a path. Maybe module.
std::string module = fname; std::string module = fname;
module += ".cmake"; module += ".cmake";
std::string mfile = this->Makefile->GetModulesFile(module.c_str()); std::string mfile = this->Makefile->GetModulesFile(module);
if (!mfile.empty()) { if (!mfile.empty()) {
fname = mfile; fname = mfile;
} }
} }
std::string fname_abs = cmSystemTools::CollapseFullPath( std::string fname_abs = cmSystemTools::CollapseFullPath(
fname, this->Makefile->GetCurrentSourceDirectory()); fname, this->Makefile->GetCurrentSourceDirectory());
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
if (gg->IsExportedTargetsFile(fname_abs)) { if (gg->IsExportedTargetsFile(fname_abs)) {
const char* modal = nullptr; const char* modal = nullptr;
std::ostringstream e; std::ostringstream e;
cmake::MessageType messageType = cmake::AUTHOR_WARNING; MessageType messageType = MessageType::AUTHOR_WARNING;
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0024)) { switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0024)) {
case cmPolicies::WARN: case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0024) << "\n"; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0024) << "\n";
modal = "should"; modal = "should";
case cmPolicies::OLD: case cmPolicies::OLD:
break; break;
case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW: case cmPolicies::NEW:
modal = "may"; modal = "may";
messageType = cmake::FATAL_ERROR; messageType = MessageType::FATAL_ERROR;
} }
if (modal) { if (modal) {
e << "The file\n " << fname_abs e << "The file\n " << fname_abs
<< "\nwas generated by the export() " << "\nwas generated by the export() "
"command. It " "command. It "
<< modal << modal
<< " not be used as the argument to the " << " not be used as the argument to the "
"include() command. Use ALIAS targets instead to refer to targets " "include() command. Use ALIAS targets instead to refer to targets "
"by alternative names.\n"; "by alternative names.\n";
this->Makefile->IssueMessage(messageType, e.str()); this->Makefile->IssueMessage(messageType, e.str());
if (messageType == cmake::FATAL_ERROR) { if (messageType == MessageType::FATAL_ERROR) {
return false; return false;
} }
} }
gg->CreateGenerationObjects(); gg->CreateGenerationObjects();
gg->GenerateImportFile(fname_abs); gg->GenerateImportFile(fname_abs);
} }
std::string listFile = cmSystemTools::CollapseFullPath( std::string listFile = cmSystemTools::CollapseFullPath(
fname, this->Makefile->GetCurrentSourceDirectory()); fname, this->Makefile->GetCurrentSourceDirectory());
if (optional && !cmSystemTools::FileExists(listFile)) { if (optional && !cmSystemTools::FileExists(listFile)) {
if (!resultVarName.empty()) { if (!resultVarName.empty()) {
this->Makefile->AddDefinition(resultVarName, "NOTFOUND"); this->Makefile->AddDefinition(resultVarName, "NOTFOUND");
} }
return true; return true;
} }
bool readit = bool readit = this->Makefile->ReadDependentFile(listFile, noPolicyScope);
this->Makefile->ReadDependentFile(listFile.c_str(), noPolicyScope);
// add the location of the included file if a result variable was given // add the location of the included file if a result variable was given
if (!resultVarName.empty()) { if (!resultVarName.empty()) {
this->Makefile->AddDefinition(resultVarName, this->Makefile->AddDefinition(resultVarName,
readit ? fname_abs.c_str() : "NOTFOUND"); readit ? fname_abs.c_str() : "NOTFOUND");
} }
if (!optional && !readit && !cmSystemTools::GetFatalErrorOccured()) { if (!optional && !readit && !cmSystemTools::GetFatalErrorOccured()) {
std::string m = "could not find load file:\n" std::string m = "could not find load file:\n"
" "; " ";
 End of changes. 8 change blocks. 
8 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)