cmGeneratorTarget_Sources.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. /* clang-format off */
  4. #include "cmGeneratorTarget.h"
  5. /* clang-format on */
  6. #include <cstddef>
  7. #include <map>
  8. #include <memory>
  9. #include <set>
  10. #include <sstream>
  11. #include <string>
  12. #include <type_traits>
  13. #include <unordered_set>
  14. #include <utility>
  15. #include <vector>
  16. #include <cm/string_view>
  17. #include <cmext/algorithm>
  18. #include <cmext/string_view>
  19. #include "cmsys/RegularExpression.hxx"
  20. #include "cmAlgorithms.h"
  21. #include "cmEvaluatedTargetProperty.h"
  22. #include "cmFileSet.h"
  23. #include "cmGeneratorExpression.h"
  24. #include "cmGeneratorExpressionDAGChecker.h"
  25. #include "cmGlobalGenerator.h"
  26. #include "cmLinkItem.h"
  27. #include "cmList.h"
  28. #include "cmListFileCache.h"
  29. #include "cmLocalGenerator.h"
  30. #include "cmMakefile.h"
  31. #include "cmMessageType.h"
  32. #include "cmSourceFile.h"
  33. #include "cmSourceFileLocation.h"
  34. #include "cmSourceGroup.h"
  35. #include "cmStateTypes.h"
  36. #include "cmStringAlgorithms.h"
  37. #include "cmSystemTools.h"
  38. #include "cmTarget.h"
  39. #include "cmValue.h"
  40. #include "cmake.h"
  41. namespace {
  42. using UseTo = cmGeneratorTarget::UseTo;
  43. void AddObjectEntries(cmGeneratorTarget const* headTarget,
  44. std::string const& config,
  45. cmGeneratorExpressionDAGChecker* dagChecker,
  46. EvaluatedTargetPropertyEntries& entries)
  47. {
  48. if (cmLinkImplementationLibraries const* impl =
  49. headTarget->GetLinkImplementationLibraries(config, UseTo::Compile)) {
  50. entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
  51. for (cmLinkImplItem const& lib : impl->Libraries) {
  52. if (lib.Target &&
  53. lib.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
  54. std::string uniqueName =
  55. headTarget->GetGlobalGenerator()->IndexGeneratorTargetUniquely(
  56. lib.Target);
  57. std::string genex = "$<TARGET_OBJECTS:" + std::move(uniqueName) + ">";
  58. cmGeneratorExpression ge(*headTarget->Makefile->GetCMakeInstance(),
  59. lib.Backtrace);
  60. std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
  61. cge->SetEvaluateForBuildsystem(true);
  62. EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
  63. cmExpandList(cge->Evaluate(headTarget->GetLocalGenerator(), config,
  64. headTarget, dagChecker),
  65. ee.Values);
  66. if (cge->GetHadContextSensitiveCondition()) {
  67. ee.ContextDependent = true;
  68. }
  69. entries.Entries.emplace_back(std::move(ee));
  70. }
  71. }
  72. }
  73. }
  74. void addFileSetEntry(cmGeneratorTarget const* headTarget,
  75. std::string const& config,
  76. cmGeneratorExpressionDAGChecker* dagChecker,
  77. cmFileSet const* fileSet,
  78. EvaluatedTargetPropertyEntries& entries)
  79. {
  80. auto dirCges = fileSet->CompileDirectoryEntries();
  81. auto dirs = fileSet->EvaluateDirectoryEntries(
  82. dirCges, headTarget->GetLocalGenerator(), config, headTarget, dagChecker);
  83. bool contextSensitiveDirs = false;
  84. for (auto const& dirCge : dirCges) {
  85. if (dirCge->GetHadContextSensitiveCondition()) {
  86. contextSensitiveDirs = true;
  87. break;
  88. }
  89. }
  90. cmake* cm = headTarget->GetLocalGenerator()->GetCMakeInstance();
  91. for (auto& entryCge : fileSet->CompileFileEntries()) {
  92. auto tpe = cmGeneratorTarget::TargetPropertyEntry::CreateFileSet(
  93. dirs, contextSensitiveDirs, std::move(entryCge), fileSet);
  94. entries.Entries.emplace_back(
  95. EvaluateTargetPropertyEntry(headTarget, config, "", dagChecker, *tpe));
  96. EvaluatedTargetPropertyEntry const& entry = entries.Entries.back();
  97. for (auto const& file : entry.Values) {
  98. auto* sf = headTarget->Makefile->GetOrCreateSource(file);
  99. if (fileSet->GetType() == "HEADERS"_s) {
  100. sf->SetProperty("HEADER_FILE_ONLY", "TRUE");
  101. }
  102. #ifndef CMAKE_BOOTSTRAP
  103. std::string e;
  104. std::string w;
  105. auto path = sf->ResolveFullPath(&e, &w);
  106. if (!w.empty()) {
  107. cm->IssueMessage(MessageType::AUTHOR_WARNING, w, entry.Backtrace);
  108. }
  109. if (path.empty()) {
  110. if (!e.empty()) {
  111. cm->IssueMessage(MessageType::FATAL_ERROR, e, entry.Backtrace);
  112. }
  113. return;
  114. }
  115. bool found = false;
  116. for (auto const& sg : headTarget->Makefile->GetSourceGroups()) {
  117. if (sg.MatchChildrenFiles(path)) {
  118. found = true;
  119. break;
  120. }
  121. }
  122. if (!found) {
  123. if (fileSet->GetType() == "HEADERS"_s) {
  124. headTarget->Makefile->GetOrCreateSourceGroup("Header Files")
  125. ->AddGroupFile(path);
  126. }
  127. }
  128. #endif
  129. }
  130. }
  131. }
  132. void AddFileSetEntries(cmGeneratorTarget const* headTarget,
  133. std::string const& config,
  134. cmGeneratorExpressionDAGChecker* dagChecker,
  135. EvaluatedTargetPropertyEntries& entries)
  136. {
  137. for (auto const& entry : headTarget->Target->GetHeaderSetsEntries()) {
  138. for (auto const& name : cmList{ entry.Value }) {
  139. auto const* headerSet = headTarget->Target->GetFileSet(name);
  140. addFileSetEntry(headTarget, config, dagChecker, headerSet, entries);
  141. }
  142. }
  143. for (auto const& entry : headTarget->Target->GetCxxModuleSetsEntries()) {
  144. for (auto const& name : cmList{ entry.Value }) {
  145. auto const* cxxModuleSet = headTarget->Target->GetFileSet(name);
  146. addFileSetEntry(headTarget, config, dagChecker, cxxModuleSet, entries);
  147. }
  148. }
  149. }
  150. bool processSources(cmGeneratorTarget const* tgt,
  151. EvaluatedTargetPropertyEntries& entries,
  152. std::vector<BT<std::string>>& srcs,
  153. std::unordered_set<std::string>& uniqueSrcs,
  154. bool debugSources)
  155. {
  156. cmMakefile* mf = tgt->Target->GetMakefile();
  157. bool contextDependent = entries.HadContextSensitiveCondition;
  158. for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
  159. if (entry.ContextDependent) {
  160. contextDependent = true;
  161. }
  162. cmLinkImplItem const& item = entry.LinkImplItem;
  163. std::string const& targetName = item.AsStr();
  164. for (std::string& src : entry.Values) {
  165. cmSourceFile* sf = mf->GetOrCreateSource(src);
  166. std::string e;
  167. std::string w;
  168. std::string fullPath = sf->ResolveFullPath(&e, &w);
  169. cmake* cm = tgt->GetLocalGenerator()->GetCMakeInstance();
  170. if (!w.empty()) {
  171. cm->IssueMessage(MessageType::AUTHOR_WARNING, w, entry.Backtrace);
  172. }
  173. if (fullPath.empty()) {
  174. if (!e.empty()) {
  175. cm->IssueMessage(MessageType::FATAL_ERROR, e, entry.Backtrace);
  176. }
  177. return contextDependent;
  178. }
  179. if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src)) {
  180. std::ostringstream err;
  181. if (!targetName.empty()) {
  182. err << "Target \"" << targetName
  183. << "\" contains relative path in its INTERFACE_SOURCES:\n \""
  184. << src << "\"";
  185. } else {
  186. err << "Found relative path while evaluating sources of \""
  187. << tgt->GetName() << "\":\n \"" << src << "\"\n";
  188. }
  189. tgt->GetLocalGenerator()->IssueMessage(MessageType::FATAL_ERROR,
  190. err.str());
  191. return contextDependent;
  192. }
  193. src = fullPath;
  194. }
  195. std::string usedSources;
  196. for (std::string const& src : entry.Values) {
  197. if (uniqueSrcs.insert(src).second) {
  198. srcs.emplace_back(src, entry.Backtrace);
  199. if (debugSources) {
  200. usedSources += " * " + src + "\n";
  201. }
  202. }
  203. }
  204. if (!usedSources.empty()) {
  205. tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
  206. MessageType::LOG,
  207. std::string("Used sources for target ") + tgt->GetName() + ":\n" +
  208. usedSources,
  209. entry.Backtrace);
  210. }
  211. }
  212. return contextDependent;
  213. }
  214. }
  215. std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
  216. std::string const& config) const
  217. {
  218. std::vector<BT<std::string>> files;
  219. if (!this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) {
  220. // At configure-time, this method can be called as part of getting the
  221. // LOCATION property or to export() a file to be include()d. However
  222. // there is no cmGeneratorTarget at configure-time, so search the SOURCES
  223. // for TARGET_OBJECTS instead for backwards compatibility with OLD
  224. // behavior of CMP0024 and CMP0026 only.
  225. cmBTStringRange sourceEntries = this->Target->GetSourceEntries();
  226. for (auto const& entry : sourceEntries) {
  227. cmList items{ entry.Value };
  228. for (auto const& item : items) {
  229. if (cmHasLiteralPrefix(item, "$<TARGET_OBJECTS:") &&
  230. item.back() == '>') {
  231. continue;
  232. }
  233. files.emplace_back(item);
  234. }
  235. }
  236. return files;
  237. }
  238. cmList debugProperties{ this->Makefile->GetDefinition(
  239. "CMAKE_DEBUG_TARGET_PROPERTIES") };
  240. bool debugSources =
  241. !this->DebugSourcesDone && cm::contains(debugProperties, "SOURCES");
  242. if (this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) {
  243. this->DebugSourcesDone = true;
  244. }
  245. cmGeneratorExpressionDAGChecker dagChecker(this, "SOURCES", nullptr, nullptr,
  246. this->LocalGenerator, config);
  247. EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
  248. this, config, std::string(), &dagChecker, this->SourceEntries);
  249. std::unordered_set<std::string> uniqueSrcs;
  250. bool contextDependentDirectSources =
  251. processSources(this, entries, files, uniqueSrcs, debugSources);
  252. // Collect INTERFACE_SOURCES of all direct link-dependencies.
  253. EvaluatedTargetPropertyEntries linkInterfaceSourcesEntries;
  254. AddInterfaceEntries(this, config, "INTERFACE_SOURCES", std::string(),
  255. &dagChecker, linkInterfaceSourcesEntries,
  256. IncludeRuntimeInterface::No, UseTo::Compile);
  257. bool contextDependentInterfaceSources = processSources(
  258. this, linkInterfaceSourcesEntries, files, uniqueSrcs, debugSources);
  259. // Collect TARGET_OBJECTS of direct object link-dependencies.
  260. bool contextDependentObjects = false;
  261. if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
  262. EvaluatedTargetPropertyEntries linkObjectsEntries;
  263. AddObjectEntries(this, config, &dagChecker, linkObjectsEntries);
  264. contextDependentObjects = processSources(this, linkObjectsEntries, files,
  265. uniqueSrcs, debugSources);
  266. // Note that for imported targets or multi-config generators supporting
  267. // cross-config builds the paths to the object files must be per-config,
  268. // so contextDependentObjects will be true here even if object libraries
  269. // are specified without per-config generator expressions.
  270. }
  271. // Collect this target's file sets.
  272. EvaluatedTargetPropertyEntries fileSetEntries;
  273. AddFileSetEntries(this, config, &dagChecker, fileSetEntries);
  274. bool contextDependentFileSets =
  275. processSources(this, fileSetEntries, files, uniqueSrcs, debugSources);
  276. // Determine if sources are context-dependent or not.
  277. if (!contextDependentDirectSources && !contextDependentInterfaceSources &&
  278. !contextDependentObjects && !contextDependentFileSets) {
  279. this->SourcesAreContextDependent = Tribool::False;
  280. } else {
  281. this->SourcesAreContextDependent = Tribool::True;
  282. }
  283. return files;
  284. }
  285. void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*>& files,
  286. const std::string& config) const
  287. {
  288. std::vector<BT<cmSourceFile*>> tmp = this->GetSourceFiles(config);
  289. files.reserve(tmp.size());
  290. for (BT<cmSourceFile*>& v : tmp) {
  291. files.push_back(v.Value);
  292. }
  293. }
  294. std::vector<BT<cmSourceFile*>> cmGeneratorTarget::GetSourceFiles(
  295. std::string const& config) const
  296. {
  297. std::vector<BT<cmSourceFile*>> files;
  298. if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) {
  299. // Since we are still configuring not all sources may exist yet,
  300. // so we need to avoid full source classification because that
  301. // requires the absolute paths to all sources to be determined.
  302. // Since this is only for compatibility with old policies that
  303. // projects should not depend on anymore, just compute the files
  304. // without memoizing them.
  305. std::vector<BT<std::string>> srcs = this->GetSourceFilePaths(config);
  306. std::set<cmSourceFile*> emitted;
  307. for (BT<std::string> const& s : srcs) {
  308. cmSourceFile* sf = this->Makefile->GetOrCreateSource(s.Value);
  309. if (emitted.insert(sf).second) {
  310. files.emplace_back(sf, s.Backtrace);
  311. }
  312. }
  313. return files;
  314. }
  315. KindedSources const& kinded = this->GetKindedSources(config);
  316. files.reserve(kinded.Sources.size());
  317. for (SourceAndKind const& si : kinded.Sources) {
  318. files.push_back(si.Source);
  319. }
  320. return files;
  321. }
  322. void cmGeneratorTarget::GetSourceFilesWithoutObjectLibraries(
  323. std::vector<cmSourceFile*>& files, const std::string& config) const
  324. {
  325. std::vector<BT<cmSourceFile*>> tmp =
  326. this->GetSourceFilesWithoutObjectLibraries(config);
  327. files.reserve(tmp.size());
  328. for (BT<cmSourceFile*>& v : tmp) {
  329. files.push_back(v.Value);
  330. }
  331. }
  332. std::vector<BT<cmSourceFile*>>
  333. cmGeneratorTarget::GetSourceFilesWithoutObjectLibraries(
  334. std::string const& config) const
  335. {
  336. std::vector<BT<cmSourceFile*>> files;
  337. KindedSources const& kinded = this->GetKindedSources(config);
  338. files.reserve(kinded.Sources.size());
  339. for (SourceAndKind const& si : kinded.Sources) {
  340. if (si.Source.Value->GetObjectLibrary().empty()) {
  341. files.push_back(si.Source);
  342. }
  343. }
  344. return files;
  345. }
  346. cmGeneratorTarget::KindedSources const& cmGeneratorTarget::GetKindedSources(
  347. std::string const& config) const
  348. {
  349. // If we already processed one configuration and found no dependency
  350. // on configuration then always use the one result.
  351. if (this->SourcesAreContextDependent == Tribool::False) {
  352. return this->KindedSourcesMap.begin()->second;
  353. }
  354. // Lookup any existing link implementation for this configuration.
  355. std::string const key = cmSystemTools::UpperCase(config);
  356. auto it = this->KindedSourcesMap.find(key);
  357. if (it != this->KindedSourcesMap.end()) {
  358. if (!it->second.Initialized) {
  359. std::ostringstream e;
  360. e << "The SOURCES of \"" << this->GetName()
  361. << "\" use a generator expression that depends on the "
  362. "SOURCES themselves.";
  363. this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
  364. MessageType::FATAL_ERROR, e.str(), this->GetBacktrace());
  365. static KindedSources empty;
  366. return empty;
  367. }
  368. return it->second;
  369. }
  370. // Add an entry to the map for this configuration.
  371. KindedSources& files = this->KindedSourcesMap[key];
  372. this->ComputeKindedSources(files, config);
  373. files.Initialized = true;
  374. return files;
  375. }
  376. void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
  377. std::string const& config) const
  378. {
  379. // Get the source file paths by string.
  380. std::vector<BT<std::string>> srcs = this->GetSourceFilePaths(config);
  381. cmsys::RegularExpression header_regex(CM_HEADER_REGEX);
  382. std::vector<cmSourceFile*> badObjLib;
  383. std::set<cmSourceFile*> emitted;
  384. for (BT<std::string> const& s : srcs) {
  385. // Create each source at most once.
  386. cmSourceFile* sf = this->Makefile->GetOrCreateSource(s.Value);
  387. if (!emitted.insert(sf).second) {
  388. continue;
  389. }
  390. // Compute the kind (classification) of this source file.
  391. SourceKind kind;
  392. std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
  393. cmFileSet const* fs = this->GetFileSetForSource(config, sf);
  394. if (sf->GetCustomCommand()) {
  395. kind = SourceKindCustomCommand;
  396. } else if (!this->Target->IsNormal() && !this->Target->IsImported() &&
  397. fs && (fs->GetType() == "CXX_MODULES"_s)) {
  398. kind = SourceKindCxxModuleSource;
  399. } else if (this->Target->GetType() == cmStateEnums::UTILITY ||
  400. this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY
  401. // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
  402. // NOLINTNEXTLINE(bugprone-branch-clone)
  403. ) {
  404. kind = SourceKindExtra;
  405. } else if (this->IsSourceFilePartOfUnityBatch(sf->ResolveFullPath())) {
  406. kind = SourceKindUnityBatched;
  407. // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
  408. // NOLINTNEXTLINE(bugprone-branch-clone)
  409. } else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) {
  410. kind = SourceKindHeader;
  411. } else if (sf->GetPropertyAsBool("EXTERNAL_OBJECT")) {
  412. kind = SourceKindExternalObject;
  413. } else if (!sf->GetOrDetermineLanguage().empty()) {
  414. kind = SourceKindObjectSource;
  415. } else if (ext == "def") {
  416. kind = SourceKindModuleDefinition;
  417. if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
  418. badObjLib.push_back(sf);
  419. }
  420. } else if (ext == "idl") {
  421. kind = SourceKindIDL;
  422. if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
  423. badObjLib.push_back(sf);
  424. }
  425. } else if (ext == "resx") {
  426. kind = SourceKindResx;
  427. } else if (ext == "appxmanifest") {
  428. kind = SourceKindAppManifest;
  429. } else if (ext == "manifest") {
  430. if (sf->GetPropertyAsBool("VS_DEPLOYMENT_CONTENT")) {
  431. kind = SourceKindExtra;
  432. } else {
  433. kind = SourceKindManifest;
  434. }
  435. } else if (ext == "pfx") {
  436. kind = SourceKindCertificate;
  437. } else if (ext == "xaml") {
  438. kind = SourceKindXaml;
  439. } else if (header_regex.find(sf->ResolveFullPath())) {
  440. kind = SourceKindHeader;
  441. } else {
  442. kind = SourceKindExtra;
  443. }
  444. // Save this classified source file in the result vector.
  445. files.Sources.push_back({ BT<cmSourceFile*>(sf, s.Backtrace), kind });
  446. }
  447. if (!badObjLib.empty()) {
  448. std::ostringstream e;
  449. e << "OBJECT library \"" << this->GetName() << "\" contains:\n";
  450. for (cmSourceFile* i : badObjLib) {
  451. e << " " << i->GetLocation().GetName() << "\n";
  452. }
  453. e << "but may contain only sources that compile, header files, and "
  454. "other files that would not affect linking of a normal library.";
  455. this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
  456. MessageType::FATAL_ERROR, e.str(), this->GetBacktrace());
  457. }
  458. }
  459. std::vector<cmGeneratorTarget::AllConfigSource> const&
  460. cmGeneratorTarget::GetAllConfigSources() const
  461. {
  462. if (this->AllConfigSources.empty()) {
  463. this->ComputeAllConfigSources();
  464. }
  465. return this->AllConfigSources;
  466. }
  467. void cmGeneratorTarget::ComputeAllConfigSources() const
  468. {
  469. std::vector<std::string> configs =
  470. this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
  471. std::map<cmSourceFile const*, size_t> index;
  472. for (size_t ci = 0; ci < configs.size(); ++ci) {
  473. KindedSources const& sources = this->GetKindedSources(configs[ci]);
  474. for (SourceAndKind const& src : sources.Sources) {
  475. auto mi = index.find(src.Source.Value);
  476. if (mi == index.end()) {
  477. AllConfigSource acs;
  478. acs.Source = src.Source.Value;
  479. acs.Kind = src.Kind;
  480. this->AllConfigSources.push_back(std::move(acs));
  481. std::map<cmSourceFile const*, size_t>::value_type entry(
  482. src.Source.Value, this->AllConfigSources.size() - 1);
  483. mi = index.insert(entry).first;
  484. }
  485. this->AllConfigSources[mi->second].Configs.push_back(ci);
  486. }
  487. }
  488. }
  489. std::vector<cmGeneratorTarget::AllConfigSource>
  490. cmGeneratorTarget::GetAllConfigSources(SourceKind kind) const
  491. {
  492. std::vector<AllConfigSource> result;
  493. for (AllConfigSource const& source : this->GetAllConfigSources()) {
  494. if (source.Kind == kind) {
  495. result.push_back(source);
  496. }
  497. }
  498. return result;
  499. }
  500. std::set<std::string> cmGeneratorTarget::GetAllConfigCompileLanguages() const
  501. {
  502. std::set<std::string> languages;
  503. std::vector<AllConfigSource> const& sources = this->GetAllConfigSources();
  504. for (AllConfigSource const& si : sources) {
  505. std::string const& lang = si.Source->GetOrDetermineLanguage();
  506. if (!lang.empty()) {
  507. languages.emplace(lang);
  508. }
  509. }
  510. return languages;
  511. }