summaryrefslogtreecommitdiffstats
path: root/Source/cmSetPropertyCommand.cxx
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-07-08 20:12:02 (GMT)
committerBrad King <brad.king@kitware.com>2020-07-09 10:33:52 (GMT)
commit1235f2d747770535a388cd763c95cde8c9244375 (patch)
tree5fe38c96951731f04e7904fa9fc5316d9e386207 /Source/cmSetPropertyCommand.cxx
parent177052d6b8b4127a9d345830fb3d82384e9d5b50 (diff)
downloadCMake-1235f2d747770535a388cd763c95cde8c9244375.zip
CMake-1235f2d747770535a388cd763c95cde8c9244375.tar.gz
CMake-1235f2d747770535a388cd763c95cde8c9244375.tar.bz2
set_property: Allow both DIRECTORY and TARGET_DIRECTORY together
Allow to specify both DIRECTORY and TARGET_DIRECTORY at the same time in `set_source_files_properties()` and `set_property(SOURCE)` commands. Add test cases and update the documentation. Fixes: #20932
Diffstat (limited to 'Source/cmSetPropertyCommand.cxx')
-rw-r--r--Source/cmSetPropertyCommand.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 11afc14..51509fd 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -96,7 +96,9 @@ bool HandleSourceFileDirectoryScopes(
}
directory_makefiles.push_back(dir_mf);
}
- } else if (!source_file_target_directories.empty()) {
+ }
+
+ if (!source_file_target_directories.empty()) {
for (const std::string& target_name : source_file_target_directories) {
cmTarget* target = current_dir_mf->FindTargetToUse(target_name);
if (!target) {
@@ -110,7 +112,10 @@ bool HandleSourceFileDirectoryScopes(
*target_source_dir);
directory_makefiles.push_back(target_dir_mf);
}
- } else {
+ }
+
+ if (source_file_directories.empty() &&
+ source_file_target_directories.empty()) {
directory_makefiles.push_back(current_dir_mf);
}
return true;
@@ -271,12 +276,12 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args,
appendMode = true;
remove = false;
appendAsString = true;
- } else if (doing == DoingNames && scope == cmProperty::SOURCE_FILE &&
- arg == "DIRECTORY") {
+ } else if (doing != DoingProperty && doing != DoingValues &&
+ scope == cmProperty::SOURCE_FILE && arg == "DIRECTORY") {
doing = DoingSourceDirectory;
source_file_directory_option_enabled = true;
- } else if (doing == DoingNames && scope == cmProperty::SOURCE_FILE &&
- arg == "TARGET_DIRECTORY") {
+ } else if (doing != DoingProperty && doing != DoingValues &&
+ scope == cmProperty::SOURCE_FILE && arg == "TARGET_DIRECTORY") {
doing = DoingSourceTargetDirectory;
source_file_target_option_enabled = true;
} else if (doing == DoingNames) {