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

Method RunPreinstallTarget

Source/CPack/cmCPackGenerator.cxx:710–746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

708}
709
710int cmCPackGenerator::RunPreinstallTarget(
711 std::string const& installProjectName, std::string const& installDirectory,
712 cmGlobalGenerator* globalGenerator, std::string const& buildConfig)
713{
714 // Does this generator require pre-install?
715 if (char const* preinstall = globalGenerator->GetPreinstallTargetName()) {
716 std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
717 preinstall, buildConfig, "", "", false);
718 cmCPackLogger(cmCPackLog::LOG_DEBUG,
719 "- Install command: " << buildCommand << std::endl);
720 cmCPackLogger(cmCPackLog::LOG_OUTPUT,
721 "- Run preinstall target for: " << installProjectName
722 << std::endl);
723 std::string output;
724 int retVal = 1;
725 bool resB = cmSystemTools::RunSingleCommand(
726 buildCommand, &output, &output, &retVal, installDirectory.c_str(),
727 this->GeneratorVerbose, cmDuration::zero());
728 if (!resB || retVal) {
729 std::string tmpFile = cmStrCat(
730 this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/PreinstallOutput.log");
731 cmGeneratedFileStream ofs(tmpFile);
732 ofs << "# Run command: " << buildCommand << std::endl
733 << "# Directory: " << installDirectory << std::endl
734 << "# Output:" << std::endl
735 << output << std::endl;
736 cmCPackLogger(cmCPackLog::LOG_ERROR,
737 "Problem running install command: "
738 << buildCommand << std::endl
739 << "Please check " << tmpFile << " for errors"
740 << std::endl);
741 return 0;
742 }
743 }
744
745 return 1;
746}
747
748int cmCPackGenerator::InstallCMakeProject(
749 bool setDestDir, std::string const& installDirectory,

Calls 5

GetOptionMethod · 0.95
c_strMethod · 0.80
cmStrCatFunction · 0.50

Tested by

no test coverage detected