summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorShane Parris <shane.lee.parris@gmail.com>2018-02-14 16:30:42 (GMT)
committerShane Parris <shane.lee.parris@gmail.com>2018-03-29 14:58:03 (GMT)
commitca0befc2e10da59d2b82e4143ad913eb8322290f (patch)
tree8920f47d68e427410422412572002e9b41426db4 /Source
parent599c93e22d02d34d763d0156fcd29bb2930dec07 (diff)
downloadCMake-ca0befc2e10da59d2b82e4143ad913eb8322290f.zip
CMake-ca0befc2e10da59d2b82e4143ad913eb8322290f.tar.gz
CMake-ca0befc2e10da59d2b82e4143ad913eb8322290f.tar.bz2
Add `CONFIGURE_DEPENDS` flag support to cmFileCommand::HandleGlobCommand
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileCommand.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 90b943b..0d31070 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -758,7 +758,11 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
}
std::vector<std::string> files;
+ bool configureDepends = false;
+ bool warnConfigureLate = false;
bool warnFollowedSymlinks = false;
+ const cmake::WorkingMode workingMode =
+ this->Makefile->GetCMakeInstance()->GetWorkingMode();
while (i != args.end()) {
if (*i == "LIST_DIRECTORIES") {
++i;
@@ -807,6 +811,27 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
this->SetError("GLOB requires a glob expression after the directory.");
return false;
}
+ } else if (*i == "CONFIGURE_DEPENDS") {
+ // Generated build system depends on glob results
+ if (!configureDepends && warnConfigureLate) {
+ this->Makefile->IssueMessage(
+ cmake::AUTHOR_WARNING,
+ "CONFIGURE_DEPENDS flag was given after a glob expression was "
+ "already evaluated.");
+ }
+ if (workingMode != cmake::NORMAL_MODE) {
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ "CONFIGURE_DEPENDS is invalid for script and find package modes.");
+ return false;
+ }
+ configureDepends = true;
+ ++i;
+ if (i == args.end()) {
+ this->SetError(
+ "GLOB requires a glob expression after CONFIGURE_DEPENDS.");
+ return false;
+ }
} else {
std::string expr = *i;
if (!cmsys::SystemTools::FileIsFullPath(*i)) {
@@ -849,6 +874,19 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
std::vector<std::string>& foundFiles = g.GetFiles();
files.insert(files.end(), foundFiles.begin(), foundFiles.end());
+
+ if (configureDepends) {
+ std::sort(foundFiles.begin(), foundFiles.end());
+ foundFiles.erase(std::unique(foundFiles.begin(), foundFiles.end()),
+ foundFiles.end());
+ this->Makefile->GetCMakeInstance()->AddGlobCacheEntry(
+ recurse, (recurse ? g.GetRecurseListDirs() : g.GetListDirs()),
+ (recurse ? g.GetRecurseThroughSymlinks() : false),
+ (g.GetRelative() ? g.GetRelative() : ""), expr, foundFiles, variable,
+ this->Makefile->GetBacktrace());
+ } else {
+ warnConfigureLate = true;
+ }
++i;
}
}