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

Method GenerateBuildCommand

Source/cmGlobalVisualStudio10Generator.cxx:1076–1255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1074}
1075
1076std::vector<cmGlobalGenerator::GeneratedMakeCommand>
1077cmGlobalVisualStudio10Generator::GenerateBuildCommand(
1078 std::string const& makeProgram, std::string const& projectName,
1079 std::string const& projectDir, std::vector<std::string> const& targetNames,
1080 std::string const& config, int jobs, bool verbose,
1081 cmBuildOptions buildOptions, std::vector<std::string> const& makeOptions,
1082 BuildTryCompile /*isInTryCompile*/)
1083{
1084 std::vector<GeneratedMakeCommand> makeCommands;
1085 // Select the caller- or user-preferred make program, else MSBuild.
1086 std::string makeProgramSelected =
1087 this->SelectMakeProgram(makeProgram, this->GetMSBuildCommand());
1088
1089 std::string const slnFile = this->GetSLNFile(projectDir, projectName);
1090
1091 // Check if the caller explicitly requested a devenv tool.
1092 std::string makeProgramLower = makeProgramSelected;
1093 cmSystemTools::LowerCase(makeProgramLower);
1094 bool useDevEnv = (makeProgramLower.find("devenv") != std::string::npos ||
1095 makeProgramLower.find("vcexpress") != std::string::npos);
1096
1097 // Workaround to convince VCExpress.exe to produce output.
1098 bool const requiresOutputForward =
1099 (makeProgramLower.find("vcexpress") != std::string::npos);
1100
1101 // MSBuild is preferred (and required for VS Express), but if the .sln has
1102 // an Intel Fortran .vfproj then we have to use devenv. Parse it to find out.
1103 cmSlnxParser slnxParser;
1104 cmSlnData slnData;
1105 if (this->Version >= VSVersion::VS18) {
1106 if (slnxParser.ParseFile(slnFile.c_str())) {
1107 for (auto const& i : slnxParser.ProjectToPath) {
1108 if (cmHasLiteralSuffix(i.second, ".vfproj")) {
1109 useDevEnv = true;
1110 break;
1111 }
1112 }
1113 }
1114 } else {
1115 cmVisualStudioSlnParser parser;
1116 if (parser.ParseFile(slnFile, slnData,
1117 cmVisualStudioSlnParser::DataGroupAll)) {
1118 std::vector<cmSlnProjectEntry> slnProjects = slnData.GetProjects();
1119 for (cmSlnProjectEntry const& project : slnProjects) {
1120 std::string proj = project.GetRelativePath();
1121 if (cmHasLiteralSuffix(proj, ".vfproj")) {
1122 useDevEnv = true;
1123 break;
1124 }
1125 }
1126 }
1127 }
1128 if (useDevEnv) {
1129 // Use devenv to build solutions containing Intel Fortran projects.
1130 return cmGlobalVisualStudio7Generator::GenerateBuildCommand(
1131 makeProgram, projectName, projectDir, targetNames, config, jobs, verbose,
1132 buildOptions, makeOptions);
1133 }

Callers

nothing calls this directly

Calls 15

cmHasLiteralSuffixFunction · 0.85
moveFunction · 0.85
SelectMakeProgramMethod · 0.80
GetSLNFileMethod · 0.80
c_strMethod · 0.80
GetProjectsMethod · 0.80
GetProjectByNameMethod · 0.80
emplace_backMethod · 0.80
GetIDEVersionMethod · 0.80
cmStrCatFunction · 0.70
findMethod · 0.45

Tested by

no test coverage detected