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

Method AddGlobalTarget_PackageSource

Source/cmGlobalGenerator.cxx:2974–3008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2972}
2973
2974void cmGlobalGenerator::AddGlobalTarget_PackageSource(
2975 std::vector<GlobalTargetInfo>& targets)
2976{
2977 char const* packageSourceTargetName = this->GetPackageSourceTargetName();
2978 if (!packageSourceTargetName) {
2979 return;
2980 }
2981
2982 auto& mf = this->Makefiles[0];
2983 std::string configFile =
2984 cmStrCat(mf->GetCurrentBinaryDirectory(), "/CPackSourceConfig.cmake");
2985 if (!cmSystemTools::FileExists(configFile)) {
2986 return;
2987 }
2988
2989 static auto const reservedTargets = { "package_source" };
2990 for (auto const& target : reservedTargets) {
2991 if (!this->CheckReservedTargetName(
2992 target, "when CPack source packaging is enabled")) {
2993 return;
2994 }
2995 }
2996
2997 GlobalTargetInfo gti;
2998 gti.Name = packageSourceTargetName;
2999 gti.Message = "Run CPack packaging tool for source...";
3000 gti.WorkingDir = mf->GetCurrentBinaryDirectory();
3001 gti.UsesTerminal = true;
3002 cmCustomCommandLine singleLine;
3003 singleLine.push_back(cmSystemTools::GetCPackCommand());
3004 singleLine.push_back("--config");
3005 singleLine.push_back("./CPackSourceConfig.cmake");
3006 gti.CommandLines.push_back(std::move(singleLine));
3007 targets.push_back(std::move(gti));
3008}
3009
3010void cmGlobalGenerator::AddGlobalTarget_Test(
3011 std::vector<GlobalTargetInfo>& targets)

Callers 1

Calls 6

moveFunction · 0.85
push_backMethod · 0.80
cmStrCatFunction · 0.70
FileExistsFunction · 0.50

Tested by

no test coverage detected