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

Method WriteHelpRule

Source/cmGlobalUnixMakefileGenerator3.cxx:935–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

933}
934
935void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
936 std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3* lg)
937{
938 // add the help target
939 std::string path;
940 std::vector<std::string> no_depends;
941 std::vector<std::string> commands;
942 lg->AppendEcho(commands,
943 "The following are some of the valid targets "
944 "for this Makefile:");
945 lg->AppendEcho(commands, "... all (the default if no target is provided)");
946 lg->AppendEcho(commands, "... clean");
947 if (!this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION")) {
948 lg->AppendEcho(commands, "... depend");
949 }
950 if (this->CheckCMP0171()) {
951 lg->AppendEcho(commands, "... codegen");
952 }
953
954 // Keep track of targets already listed.
955 std::set<std::string> emittedTargets;
956 std::set<std::string> utility_targets;
957 std::set<std::string> globals_targets;
958 std::set<std::string> project_targets;
959
960 // for each local generator
961 for (auto const& localGen : this->LocalGenerators) {
962 auto const& lg2 =
963 cm::static_reference_cast<cmLocalUnixMakefileGenerator3>(localGen);
964 // for the passed in makefile or if this is the top Makefile wripte out
965 // the targets
966 if (&lg2 == lg || lg->IsRootMakefile()) {
967 // for each target Generate the rule files for each target.
968 for (auto const& target : lg2.GetGeneratorTargets()) {
969 cmStateEnums::TargetType type = target->GetType();
970 if ((type == cmStateEnums::EXECUTABLE) ||
971 (type == cmStateEnums::STATIC_LIBRARY) ||
972 (type == cmStateEnums::SHARED_LIBRARY) ||
973 (type == cmStateEnums::MODULE_LIBRARY) ||
974 (type == cmStateEnums::OBJECT_LIBRARY) ||
975 (type == cmStateEnums::INTERFACE_LIBRARY &&
976 target->IsInBuildSystem())) {
977 project_targets.insert(target->GetName());
978 } else if (type == cmStateEnums::GLOBAL_TARGET) {
979 globals_targets.insert(target->GetName());
980 } else if (type == cmStateEnums::UTILITY) {
981 utility_targets.insert(target->GetName());
982 }
983 }
984 }
985 }
986
987 for (std::string const& name : globals_targets) {
988 path = cmStrCat("... ", name);
989 lg->AppendEcho(commands, path);
990 }
991 for (std::string const& name : utility_targets) {
992 path = cmStrCat("... ", name);

Callers 1

WriteLocalMakefileMethod · 0.80

Calls 10

AppendEchoMethod · 0.80
GlobalSettingIsOnMethod · 0.80
CheckCMP0171Method · 0.80
IsInBuildSystemMethod · 0.80
cmStrCatFunction · 0.70
IsRootMakefileMethod · 0.45
GetTypeMethod · 0.45
insertMethod · 0.45
GetNameMethod · 0.45
WriteMakeRuleMethod · 0.45

Tested by

no test coverage detected