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

Method FindMakeProgram

Source/cmGlobalGenerator.cxx:416–456  ·  view source on GitHub ↗

Find the make program for the generator, required for try compiles

Source from the content-addressed store, hash-verified

414
415// Find the make program for the generator, required for try compiles
416bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
417{
418 if (this->FindMakeProgramFile.empty()) {
419 cmSystemTools::Error(
420 "Generator implementation error, "
421 "all generators must specify this->FindMakeProgramFile");
422 return false;
423 }
424 if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
425 std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile);
426 if (!setMakeProgram.empty()) {
427 mf->ReadListFile(setMakeProgram);
428 }
429 }
430 if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
431 std::ostringstream err;
432 err << "CMake was unable to find a build program corresponding to \""
433 << this->GetName()
434 << "\". CMAKE_MAKE_PROGRAM is not set. You "
435 "probably need to select a different build tool.";
436 cmSystemTools::Error(err.str());
437 cmSystemTools::SetFatalErrorOccurred();
438 return false;
439 }
440 std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
441 // if there are spaces in the make program use short path
442 // but do not short path the actual program name, as
443 // this can cause trouble with VSExpress
444 if (makeProgram.find(' ') != std::string::npos) {
445 std::string dir;
446 std::string file;
447 cmSystemTools::SplitProgramPath(makeProgram, dir, file);
448 std::string saveFile = file;
449 cmSystemTools::GetShortPath(makeProgram, makeProgram);
450 cmSystemTools::SplitProgramPath(makeProgram, dir, file);
451 makeProgram = cmStrCat(dir, '/', saveFile);
452 mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram, "make program",
453 cmStateEnums::FILEPATH);
454 }
455 return true;
456}
457
458bool cmGlobalGenerator::CheckLanguages(
459 std::vector<std::string> const& /* languages */, cmMakefile* /* mf */) const

Callers 1

EnableLanguageMethod · 0.95

Calls 11

GetNameMethod · 0.95
strMethod · 0.80
ErrorClass · 0.70
cmStrCatFunction · 0.70
emptyMethod · 0.45
IsOffMethod · 0.45
GetDefinitionMethod · 0.45
GetModulesFileMethod · 0.45
ReadListFileMethod · 0.45
findMethod · 0.45
AddCacheDefinitionMethod · 0.45

Tested by

no test coverage detected