| 145 | } |
| 146 | |
| 147 | bool HandleSourceFileDirectoryScopes( |
| 148 | cmExecutionStatus& status, std::vector<std::string>& source_file_directories, |
| 149 | std::vector<std::string>& source_file_target_directories, |
| 150 | std::vector<cmMakefile*>& directory_makefiles) |
| 151 | { |
| 152 | std::unordered_set<cmMakefile*> directory_makefiles_set; |
| 153 | |
| 154 | cmMakefile* current_dir_mf = &status.GetMakefile(); |
| 155 | if (!source_file_directories.empty()) { |
| 156 | for (std::string const& dir_path : source_file_directories) { |
| 157 | std::string const absolute_dir_path = cmSystemTools::CollapseFullPath( |
| 158 | dir_path, current_dir_mf->GetCurrentSourceDirectory()); |
| 159 | cmMakefile* dir_mf = |
| 160 | status.GetMakefile().GetGlobalGenerator()->FindMakefile( |
| 161 | absolute_dir_path); |
| 162 | if (!dir_mf) { |
| 163 | status.SetError(cmStrCat("given non-existent DIRECTORY ", dir_path)); |
| 164 | return false; |
| 165 | } |
| 166 | if (directory_makefiles_set.find(dir_mf) == |
| 167 | directory_makefiles_set.end()) { |
| 168 | directory_makefiles.push_back(dir_mf); |
| 169 | directory_makefiles_set.insert(dir_mf); |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | if (!source_file_target_directories.empty()) { |
| 175 | for (std::string const& target_name : source_file_target_directories) { |
| 176 | cmTarget* target = current_dir_mf->FindTargetToUse(target_name); |
| 177 | if (!target) { |
| 178 | status.SetError(cmStrCat( |
| 179 | "given non-existent target for TARGET_DIRECTORY ", target_name)); |
| 180 | return false; |
| 181 | } |
| 182 | cmValue target_source_dir = target->GetProperty("BINARY_DIR"); |
| 183 | cmMakefile* target_dir_mf = |
| 184 | status.GetMakefile().GetGlobalGenerator()->FindMakefile( |
| 185 | *target_source_dir); |
| 186 | |
| 187 | if (directory_makefiles_set.find(target_dir_mf) == |
| 188 | directory_makefiles_set.end()) { |
| 189 | directory_makefiles.push_back(target_dir_mf); |
| 190 | directory_makefiles_set.insert(target_dir_mf); |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | if (source_file_directories.empty() && |
| 196 | source_file_target_directories.empty()) { |
| 197 | directory_makefiles.push_back(current_dir_mf); |
| 198 | } |
| 199 | return true; |
| 200 | } |
| 201 | |
| 202 | bool HandleSourceFileDirectoryScopeValidation( |
| 203 | cmExecutionStatus& status, bool source_file_directory_option_enabled, |
no test coverage detected
searching dependent graphs…