summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2020-07-14 22:59:30 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-07-14 22:59:39 (GMT)
commita335999021faa8430a0e33ee70754ebb0c74b117 (patch)
tree9b640cba2125b78842343ad974c4085049453d6b /Source
parent8c6cce27ca74d28e6370d1a424fc11c1d3686eb9 (diff)
parentf6969b917d5d74c11207b977e7a8168f24b797dc (diff)
downloadCMake-a335999021faa8430a0e33ee70754ebb0c74b117.zip
CMake-a335999021faa8430a0e33ee70754ebb0c74b117.tar.gz
CMake-a335999021faa8430a0e33ee70754ebb0c74b117.tar.bz2
Merge topic 'source_file_props_dedup_scopes' into release-3.18
f6969b917d set_property: Deduplicate source file directory scopes Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5009
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSetPropertyCommand.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 51509fd..6ca763b 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -4,6 +4,7 @@
#include <set>
#include <sstream>
+#include <unordered_set>
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
@@ -82,6 +83,8 @@ bool HandleSourceFileDirectoryScopes(
std::vector<std::string>& source_file_target_directories,
std::vector<cmMakefile*>& directory_makefiles)
{
+ std::unordered_set<cmMakefile*> directory_makefiles_set;
+
cmMakefile* current_dir_mf = &status.GetMakefile();
if (!source_file_directories.empty()) {
for (const std::string& dir_path : source_file_directories) {
@@ -94,7 +97,11 @@ bool HandleSourceFileDirectoryScopes(
status.SetError(cmStrCat("given non-existent DIRECTORY ", dir_path));
return false;
}
- directory_makefiles.push_back(dir_mf);
+ if (directory_makefiles_set.find(dir_mf) ==
+ directory_makefiles_set.end()) {
+ directory_makefiles.push_back(dir_mf);
+ directory_makefiles_set.insert(dir_mf);
+ }
}
}
@@ -110,7 +117,12 @@ bool HandleSourceFileDirectoryScopes(
cmMakefile* target_dir_mf =
status.GetMakefile().GetGlobalGenerator()->FindMakefile(
*target_source_dir);
- directory_makefiles.push_back(target_dir_mf);
+
+ if (directory_makefiles_set.find(target_dir_mf) ==
+ directory_makefiles_set.end()) {
+ directory_makefiles.push_back(target_dir_mf);
+ directory_makefiles_set.insert(target_dir_mf);
+ }
}
}