cmGeneratorTarget_Sources.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  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{
  246. this, "SOURCES", nullptr, nullptr, this->LocalGenerator, config,
  247. };
  248. EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
  249. this, config, std::string(), &dagChecker, this->SourceEntries);
  250. std::unordered_set<std::string> uniqueSrcs;
  251. bool contextDependentDirectSources =
  252. processSources(this, entries, files, uniqueSrcs, debugSources);
  253. // Collect INTERFACE_SOURCES of all direct link-dependencies.
  254. EvaluatedTargetPropertyEntries linkInterfaceSourcesEntries;
  255. AddInterfaceEntries(this, config, "INTERFACE_SOURCES", std::string(),
  256. &dagChecker, linkInterfaceSourcesEntries,
  257. IncludeRuntimeInterface::No, UseTo::Compile);
  258. bool contextDependentInterfaceSources = processSources(
  259. this, linkInterfaceSourcesEntries, files, uniqueSrcs, debugSources);
  260. // Collect TARGET_OBJECTS of direct object link-dependencies.
  261. bool contextDependentObjects = false;
  262. if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
  263. EvaluatedTargetPropertyEntries linkObjectsEntries;
  264. AddObjectEntries(this, config, &dagChecker, linkObjectsEntries);
  265. contextDependentObjects = processSources(this, linkObjectsEntries, files,
  266. uniqueSrcs, debugSources);
  267. // Note that for imported targets or multi-config generators supporting
  268. // cross-config builds the paths to the object files must be per-config,
  269. // so contextDependentObjects will be true here even if object libraries
  270. // are specified without per-config generator expressions.
  271. }
  272. // Collect this target's file sets.
  273. EvaluatedTargetPropertyEntries fileSetEntries;
  274. AddFileSetEntries(this, config, &dagChecker, fileSetEntries);
  275. bool contextDependentFileSets =
  276. processSources(this, fileSetEntries, files, uniqueSrcs, debugSources);
  277. // Determine if sources are context-dependent or not.
  278. if (!contextDependentDirectSources && !contextDependentInterfaceSources &&
  279. !contextDependentObjects && !contextDependentFileSets) {
  280. this->SourcesAreContextDependent = Tribool::False;
  281. } else {
  282. this->SourcesAreContextDependent = Tribool::True;
  283. }
  284. return files;
  285. }
  286. void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*>& files,
  287. const std::string& config) const
  288. {
  289. std::vector<BT<cmSourceFile*>> tmp = this->GetSourceFiles(config);
  290. files.reserve(tmp.size());
  291. for (BT<cmSourceFile*>& v : tmp) {
  292. files.push_back(v.Value);
  293. }
  294. }
  295. std::vector<BT<cmSourceFile*>> cmGeneratorTarget::GetSourceFiles(
  296. std::string const& config) const
  297. {
  298. std::vector<BT<cmSourceFile*>> files;
  299. if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) {
  300. // Since we are still configuring not all sources may exist yet,
  301. // so we need to avoid full source classification because that
  302. // requires the absolute paths to all sources to be determined.
  303. // Since this is only for compatibility with old policies that
  304. // projects should not depend on anymore, just compute the files
  305. // without memoizing them.
  306. std::vector<BT<std::string>> srcs = this->GetSourceFilePaths(config);
  307. std::set<cmSourceFile*> emitted;
  308. for (BT<std::string> const& s : srcs) {
  309. cmSourceFile* sf = this->Makefile->GetOrCreateSource(s.Value);
  310. if (emitted.insert(sf).second) {
  311. files.emplace_back(sf, s.Backtrace);
  312. }
  313. }
  314. return files;
  315. }
  316. KindedSources const& kinded = this->GetKindedSources(config);
  317. files.reserve(kinded.Sources.size());
  318. for (SourceAndKind const& si : kinded.Sources) {
  319. files.push_back(si.Source);
  320. }
  321. return files;
  322. }
  323. void cmGeneratorTarget::GetSourceFilesWithoutObjectLibraries(
  324. std::vector<cmSourceFile*>& files, const std::string& config) const
  325. {
  326. std::vector<BT<cmSourceFile*>> tmp =
  327. this->GetSourceFilesWithoutObjectLibraries(config);
  328. files.reserve(tmp.size());
  329. for (BT<cmSourceFile*>& v : tmp) {
  330. files.push_back(v.Value);
  331. }
  332. }
  333. std::vector<BT<cmSourceFile*>>
  334. cmGeneratorTarget::GetSourceFilesWithoutObjectLibraries(
  335. std::string const& config) const
  336. {
  337. std::vector<BT<cmSourceFile*>> files;
  338. KindedSources const& kinded = this->GetKindedSources(config);
  339. files.reserve(kinded.Sources.size());
  340. for (SourceAndKind const& si : kinded.Sources) {
  341. if (si.Source.Value->GetObjectLibrary().empty()) {
  342. files.push_back(si.Source);
  343. }
  344. }
  345. return files;
  346. }
  347. cmGeneratorTarget::KindedSources const& cmGeneratorTarget::GetKindedSources(
  348. std::string const& config) const
  349. {
  350. // If we already processed one configuration and found no dependency
  351. // on configuration then always use the one result.
  352. if (this->SourcesAreContextDependent == Tribool::False) {
  353. return this->KindedSourcesMap.begin()->second;
  354. }
  355. // Lookup any existing link implementation for this configuration.
  356. std::string const key = cmSystemTools::UpperCase(config);
  357. auto it = this->KindedSourcesMap.find(key);
  358. if (it != this->KindedSourcesMap.end()) {
  359. if (!it->second.Initialized) {
  360. std::ostringstream e;
  361. e << "The SOURCES of \"" << this->GetName()
  362. << "\" use a generator expression that depends on the "
  363. "SOURCES themselves.";
  364. this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
  365. MessageType::FATAL_ERROR, e.str(), this->GetBacktrace());
  366. static KindedSources empty;
  367. return empty;
  368. }
  369. return it->second;
  370. }
  371. // Add an entry to the map for this configuration.
  372. KindedSources& files = this->KindedSourcesMap[key];
  373. this->ComputeKindedSources(files, config);
  374. files.Initialized = true;
  375. return files;
  376. }
  377. void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
  378. std::string const& config) const
  379. {
  380. // Get the source file paths by string.
  381. std::vector<BT<std::string>> srcs = this->GetSourceFilePaths(config);
  382. cmsys::RegularExpression header_regex(CM_HEADER_REGEX);
  383. std::vector<cmSourceFile*> badObjLib;
  384. std::set<cmSourceFile*> emitted;
  385. for (BT<std::string> const& s : srcs) {
  386. // Create each source at most once.
  387. cmSourceFile* sf = this->Makefile->GetOrCreateSource(s.Value);
  388. if (!emitted.insert(sf).second) {
  389. continue;
  390. }
  391. // Compute the kind (classification) of this source file.
  392. SourceKind kind;
  393. std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
  394. cmFileSet const* fs = this->GetFileSetForSource(config, sf);
  395. if (sf->GetCustomCommand()) {
  396. kind = SourceKindCustomCommand;
  397. } else if (!this->Target->IsNormal() && !this->Target->IsImported() &&
  398. fs && (fs->GetType() == "CXX_MODULES"_s)) {
  399. kind = SourceKindCxxModuleSource;
  400. } else if (this->Target->GetType() == cmStateEnums::UTILITY ||
  401. this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY
  402. // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
  403. // NOLINTNEXTLINE(bugprone-branch-clone)
  404. ) {
  405. kind = SourceKindExtra;
  406. } else if (this->IsSourceFilePartOfUnityBatch(sf->ResolveFullPath())) {
  407. kind = SourceKindUnityBatched;
  408. // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
  409. // NOLINTNEXTLINE(bugprone-branch-clone)
  410. } else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) {
  411. kind = SourceKindHeader;
  412. } else if (sf->GetPropertyAsBool("EXTERNAL_OBJECT")) {
  413. kind = SourceKindExternalObject;
  414. } else if (!sf->GetOrDetermineLanguage().empty()) {
  415. kind = SourceKindObjectSource;
  416. } else if (ext == "def") {
  417. kind = SourceKindModuleDefinition;
  418. if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
  419. badObjLib.push_back(sf);
  420. }
  421. } else if (ext == "idl") {
  422. kind = SourceKindIDL;
  423. if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
  424. badObjLib.push_back(sf);
  425. }
  426. } else if (ext == "resx") {
  427. kind = SourceKindResx;
  428. } else if (ext == "appxmanifest") {
  429. kind = SourceKindAppManifest;
  430. } else if (ext == "manifest") {
  431. if (sf->GetPropertyAsBool("VS_DEPLOYMENT_CONTENT")) {
  432. kind = SourceKindExtra;
  433. } else {
  434. kind = SourceKindManifest;
  435. }
  436. } else if (ext == "pfx") {
  437. kind = SourceKindCertificate;
  438. } else if (ext == "xaml") {
  439. kind = SourceKindXaml;
  440. } else if (header_regex.find(sf->ResolveFullPath())) {
  441. kind = SourceKindHeader;
  442. } else {
  443. kind = SourceKindExtra;
  444. }
  445. // Save this classified source file in the result vector.
  446. files.Sources.push_back({ BT<cmSourceFile*>(sf, s.Backtrace), kind });
  447. }
  448. if (!badObjLib.empty()) {
  449. std::ostringstream e;
  450. e << "OBJECT library \"" << this->GetName() << "\" contains:\n";
  451. for (cmSourceFile* i : badObjLib) {
  452. e << " " << i->GetLocation().GetName() << "\n";
  453. }
  454. e << "but may contain only sources that compile, header files, and "
  455. "other files that would not affect linking of a normal library.";
  456. this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
  457. MessageType::FATAL_ERROR, e.str(), this->GetBacktrace());
  458. }
  459. }
  460. std::vector<cmGeneratorTarget::AllConfigSource> const&
  461. cmGeneratorTarget::GetAllConfigSources() const
  462. {
  463. if (this->AllConfigSources.empty()) {
  464. this->ComputeAllConfigSources();
  465. }
  466. return this->AllConfigSources;
  467. }
  468. void cmGeneratorTarget::ComputeAllConfigSources() const
  469. {
  470. std::vector<std::string> configs =
  471. this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
  472. std::map<cmSourceFile const*, size_t> index;
  473. for (size_t ci = 0; ci < configs.size(); ++ci) {
  474. KindedSources const& sources = this->GetKindedSources(configs[ci]);
  475. for (SourceAndKind const& src : sources.Sources) {
  476. auto mi = index.find(src.Source.Value);
  477. if (mi == index.end()) {
  478. AllConfigSource acs;
  479. acs.Source = src.Source.Value;
  480. acs.Kind = src.Kind;
  481. this->AllConfigSources.push_back(std::move(acs));
  482. std::map<cmSourceFile const*, size_t>::value_type entry(
  483. src.Source.Value, this->AllConfigSources.size() - 1);
  484. mi = index.insert(entry).first;
  485. }
  486. this->AllConfigSources[mi->second].Configs.push_back(ci);
  487. }
  488. }
  489. }
  490. std::vector<cmGeneratorTarget::AllConfigSource>
  491. cmGeneratorTarget::GetAllConfigSources(SourceKind kind) const
  492. {
  493. std::vector<AllConfigSource> result;
  494. for (AllConfigSource const& source : this->GetAllConfigSources()) {
  495. if (source.Kind == kind) {
  496. result.push_back(source);
  497. }
  498. }
  499. return result;
  500. }
  501. std::set<std::string> cmGeneratorTarget::GetAllConfigCompileLanguages() const
  502. {
  503. std::set<std::string> languages;
  504. std::vector<AllConfigSource> const& sources = this->GetAllConfigSources();
  505. for (AllConfigSource const& si : sources) {
  506. std::string const& lang = si.Source->GetOrDetermineLanguage();
  507. if (!lang.empty()) {
  508. languages.emplace(lang);
  509. }
  510. }
  511. return languages;
  512. }