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

Method InstallProjectViaInstallCommands

Source/CPack/cmCPackGenerator.cxx:328–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328int cmCPackGenerator::InstallProjectViaInstallCommands(
329 bool setDestDir, std::string const& tempInstallDirectory)
330{
331 (void)setDestDir;
332 cmValue installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
333 if (cmNonempty(installCommands)) {
334 std::string tempInstallDirectoryEnv =
335 cmStrCat("CMAKE_INSTALL_PREFIX=", tempInstallDirectory);
336 cmSystemTools::PutEnv(tempInstallDirectoryEnv);
337 cmList installCommandsVector{ installCommands };
338 for (std::string const& ic : installCommandsVector) {
339 cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ic << std::endl);
340 std::string output;
341 int retVal = 1;
342 bool resB = cmSystemTools::RunSingleCommand(
343 ic, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
344 cmDuration::zero());
345 if (!resB || retVal) {
346 std::string tmpFile = cmStrCat(
347 this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/InstallOutput.log");
348 cmGeneratedFileStream ofs(tmpFile);
349 ofs << "# Run command: " << ic << std::endl
350 << "# Output:" << std::endl
351 << output << std::endl;
352 cmCPackLogger(cmCPackLog::LOG_ERROR,
353 "Problem running install command: "
354 << ic << std::endl
355 << "Please check " << tmpFile << " for errors"
356 << std::endl);
357 return 0;
358 }
359 }
360 }
361 return 1;
362}
363
364int cmCPackGenerator::InstallProjectViaInstalledDirectories(
365 bool setDestDir, std::string const& tempInstallDirectory,

Callers 1

InstallProjectMethod · 0.95

Calls 3

GetOptionMethod · 0.95
cmNonemptyFunction · 0.85
cmStrCatFunction · 0.50

Tested by

no test coverage detected