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

Method MakeCustomCommandGenerators

Source/cmLocalNinjaGenerator.cxx:812–864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

810}
811
812std::vector<cmCustomCommandGenerator>
813cmLocalNinjaGenerator::MakeCustomCommandGenerators(
814 cmCustomCommand const& cc, std::string const& fileConfig)
815{
816 cmGlobalNinjaGenerator const* gg = this->GetGlobalNinjaGenerator();
817
818 bool transformDepfile = false;
819 switch (cc.GetCMP0116Status()) {
820 case cmPolicies::WARN:
821 CM_FALLTHROUGH;
822 case cmPolicies::OLD:
823 break;
824 case cmPolicies::NEW:
825 transformDepfile = true;
826 break;
827 }
828
829 // Start with the build graph's configuration.
830 std::vector<cmCustomCommandGenerator> ccgs;
831 ccgs.emplace_back(cc, fileConfig, this, transformDepfile);
832
833 // Consider adding cross configurations.
834 if (!gg->EnableCrossConfigBuild()) {
835 return ccgs;
836 }
837
838 // Outputs and byproducts must be expressed using generator expressions.
839 for (std::string const& output : cc.GetOutputs()) {
840 if (cmGeneratorExpression::Find(output) == std::string::npos) {
841 return ccgs;
842 }
843 }
844 for (std::string const& byproduct : cc.GetByproducts()) {
845 if (cmGeneratorExpression::Find(byproduct) == std::string::npos) {
846 return ccgs;
847 }
848 }
849
850 // Tentatively add the other cross configurations.
851 for (std::string const& config : gg->GetCrossConfigs(fileConfig)) {
852 if (fileConfig != config) {
853 ccgs.emplace_back(cc, fileConfig, this, transformDepfile, config);
854 }
855 }
856
857 // If outputs and byproducts are not unique to each configuration,
858 // drop the cross configurations.
859 if (!HasUniqueOutputs(ccgs)) {
860 ccgs.erase(ccgs.begin() + 1, ccgs.end());
861 }
862
863 return ccgs;
864}
865
866void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
867 cmGeneratorTarget* target)

Callers 1

Calls 8

HasUniqueOutputsFunction · 0.85
emplace_backMethod · 0.80
GetCrossConfigsMethod · 0.80
eraseMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected