| 749 | #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" |
| 750 | |
| 751 | void cmGlobalXCodeGenerator::AddExtraTargets( |
| 752 | cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens) |
| 753 | { |
| 754 | // Add ALL_BUILD |
| 755 | auto cc = cm::make_unique<cmCustomCommand>(); |
| 756 | cc->SetCommandLines( |
| 757 | cmMakeSingleCommandLine({ "echo", "Build all projects" })); |
| 758 | cmTarget* allbuild = |
| 759 | root->AddUtilityCommand("ALL_BUILD", true, std::move(cc)); |
| 760 | |
| 761 | // Add xcconfig files to ALL_BUILD sources |
| 762 | for (auto& config : this->CurrentConfigurationTypes) { |
| 763 | auto xcconfig = cmGeneratorExpression::Evaluate( |
| 764 | this->CurrentMakefile->GetSafeDefinition("CMAKE_XCODE_XCCONFIG"), |
| 765 | this->CurrentLocalGenerator, config); |
| 766 | if (!xcconfig.empty()) { |
| 767 | auto* xcconfig_sf = allbuild->AddSource(xcconfig); |
| 768 | xcconfig_sf->SetSpecialSourceType( |
| 769 | cmSourceFile::SpecialSourceType::XcodeXCConfigFile); |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | root->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(allbuild, root)); |
| 774 | |
| 775 | // Add XCODE depend helper |
| 776 | std::string legacyDependHelperDir = root->GetCurrentBinaryDirectory(); |
| 777 | cmCustomCommandLines legacyDependHelperCommandLines; |
| 778 | if (this->XcodeBuildSystem == BuildSystem::One) { |
| 779 | legacyDependHelperCommandLines = cmMakeSingleCommandLine( |
| 780 | { "make", "-C", legacyDependHelperDir, "-f", |
| 781 | this->CurrentXCodeHackMakefile, "OBJDIR=$(OBJDIR)", |
| 782 | /* placeholder, see below */ "" }); |
| 783 | } |
| 784 | |
| 785 | // Add ZERO_CHECK |
| 786 | bool regenerate = !this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION"); |
| 787 | bool generateTopLevelProjectOnly = |
| 788 | root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY"); |
| 789 | bool isTopLevel = |
| 790 | !root->GetStateSnapshot().GetBuildsystemDirectoryParent().IsValid(); |
| 791 | bool isGenerateProject = isTopLevel || !generateTopLevelProjectOnly; |
| 792 | if (regenerate && isGenerateProject) { |
| 793 | this->CreateReRunCMakeFile(root, gens); |
| 794 | std::string file = |
| 795 | cmSystemTools::ConvertToOutputPath(this->CurrentReRunCMakeMakefile); |
| 796 | cmSystemTools::ReplaceString(file, "\\ ", " "); |
| 797 | cc = cm::make_unique<cmCustomCommand>(); |
| 798 | cc->SetCommandLines(cmMakeSingleCommandLine({ "make", "-f", file })); |
| 799 | cmTarget* check = root->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, |
| 800 | true, std::move(cc)); |
| 801 | |
| 802 | root->AddGeneratorTarget(cm::make_unique<cmGeneratorTarget>(check, root)); |
| 803 | } |
| 804 | |
| 805 | // now make the allbuild depend on all the non-utility targets |
| 806 | // in the project |
| 807 | for (auto& gen : gens) { |
| 808 | for (auto const& target : gen->GetGeneratorTargets()) { |
no test coverage detected