MCPcopy Create free account
hub / github.com/Kitware/CMake / ComputeKindedSources

Method ComputeKindedSources

Source/cmGeneratorTarget_Sources.cxx:379–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
380 std::string const& config) const
381{
382 // Get the source file paths by string.
383 std::vector<BT<std::string>> srcs = this->GetSourceFilePaths(config);
384
385 cmsys::RegularExpression header_regex(CM_HEADER_REGEX);
386 std::vector<cmSourceFile*> badObjLib;
387
388 std::set<cmSourceFile*> emitted;
389 for (BT<std::string> const& s : srcs) {
390 // Create each source at most once.
391 cmSourceFile* sf = this->Makefile->GetOrCreateSource(s.Value);
392 if (!emitted.insert(sf).second) {
393 continue;
394 }
395
396 // Compute the kind (classification) of this source file.
397 SourceKind kind;
398 std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
399 cmFileSet const* fs = this->GetFileSetForSource(config, sf);
400 if (sf->GetCustomCommand()) {
401 kind = SourceKindCustomCommand;
402 } else if (!this->Target->IsNormal() && !this->Target->IsImported() &&
403 fs && (fs->GetType() == "CXX_MODULES"_s)) {
404 kind = SourceKindCxxModuleSource;
405 } else if (this->Target->GetType() == cmStateEnums::UTILITY ||
406 this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY
407 // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
408 // NOLINTNEXTLINE(bugprone-branch-clone)
409 ) {
410 kind = SourceKindExtra;
411 } else if (this->IsSourceFilePartOfUnityBatch(sf->ResolveFullPath())) {
412 kind = SourceKindUnityBatched;
413 // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
414 // NOLINTNEXTLINE(bugprone-branch-clone)
415 } else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) {
416 kind = SourceKindHeader;
417 } else if (sf->GetPropertyAsBool("EXTERNAL_OBJECT")) {
418 kind = SourceKindExternalObject;
419 } else if (!sf->GetOrDetermineLanguage().empty()) {
420 kind = SourceKindObjectSource;
421 } else if (ext == "def") {
422 kind = SourceKindModuleDefinition;
423 if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
424 badObjLib.push_back(sf);
425 }
426 } else if (ext == "idl") {
427 kind = SourceKindIDL;
428 if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
429 badObjLib.push_back(sf);
430 }
431 } else if (ext == "resx") {
432 kind = SourceKindResx;
433 } else if (ext == "appxmanifest") {
434 kind = SourceKindAppManifest;
435 } else if (ext == "manifest") {
436 if (sf->GetPropertyAsBool("VS_DEPLOYMENT_CONTENT")) {

Callers 1

Calls 15

GetSourceFilePathsMethod · 0.95
GetFileSetForSourceMethod · 0.95
GetTypeMethod · 0.95
GetBacktraceMethod · 0.95
GetOrCreateSourceMethod · 0.80
GetExtensionMethod · 0.80
GetCustomCommandMethod · 0.80
push_backMethod · 0.80
strMethod · 0.80
insertMethod · 0.45
IsNormalMethod · 0.45

Tested by

no test coverage detected