| 746 | } |
| 747 | |
| 748 | int cmCPackGenerator::InstallCMakeProject( |
| 749 | bool setDestDir, std::string const& installDirectory, |
| 750 | std::string const& baseTempInstallDirectory, mode_t const* default_dir_mode, |
| 751 | std::string const& component, bool componentInstall, |
| 752 | std::string const& installSubDirectory, std::string const& buildConfig, |
| 753 | std::string& absoluteDestFiles) |
| 754 | { |
| 755 | std::string tempInstallDirectory = baseTempInstallDirectory; |
| 756 | std::string installFile = installDirectory + "/cmake_install.cmake"; |
| 757 | |
| 758 | if (componentInstall) { |
| 759 | cmCPackLogger(cmCPackLog::LOG_OUTPUT, |
| 760 | "- Install component: " << component << std::endl); |
| 761 | } |
| 762 | |
| 763 | cmake cm(cmState::Role::CPack); |
| 764 | cm.GetCurrentSnapshot().SetDefaultDefinitions(); |
| 765 | cm.AddCMakePaths(); |
| 766 | cm.SetProgressCallback([this](std::string const& msg, float prog) { |
| 767 | this->DisplayVerboseOutput(msg, prog); |
| 768 | }); |
| 769 | cm.SetTrace(this->Trace); |
| 770 | cm.SetTraceExpand(this->TraceExpand); |
| 771 | cmGlobalGenerator gg(&cm); |
| 772 | cmMakefile mf(&gg, cm.GetCurrentSnapshot()); |
| 773 | if (!installSubDirectory.empty() && installSubDirectory != "/" && |
| 774 | installSubDirectory != ".") { |
| 775 | tempInstallDirectory += installSubDirectory; |
| 776 | } |
| 777 | if (componentInstall) { |
| 778 | tempInstallDirectory += "/"; |
| 779 | // Some CPack generators would rather chose |
| 780 | // the local installation directory suffix. |
| 781 | // Some (e.g. RPM) use |
| 782 | // one install directory for each component **GROUP** |
| 783 | // instead of the default |
| 784 | // one install directory for each component. |
| 785 | tempInstallDirectory += this->GetComponentInstallDirNameSuffix(component); |
| 786 | |
| 787 | if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { |
| 788 | tempInstallDirectory += "/"; |
| 789 | tempInstallDirectory += *this->GetOption("CPACK_PACKAGE_FILE_NAME"); |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | cmValue default_dir_inst_permissions = |
| 794 | this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); |
| 795 | if (cmNonempty(default_dir_inst_permissions)) { |
| 796 | mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS", |
| 797 | default_dir_inst_permissions); |
| 798 | } |
| 799 | |
| 800 | if (!setDestDir) { |
| 801 | tempInstallDirectory += this->GetPackagingInstallPrefix(); |
| 802 | } |
| 803 | |
| 804 | if (setDestDir) { |
| 805 | // For DESTDIR based packaging, use the *project* |
no test coverage detected