| 2972 | } |
| 2973 | |
| 2974 | void 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 | |
| 3010 | void cmGlobalGenerator::AddGlobalTarget_Test( |
| 3011 | std::vector<GlobalTargetInfo>& targets) |
no test coverage detected