| 499 | } |
| 500 | |
| 501 | int cmCPackGenerator::InstallProjectViaInstallScript( |
| 502 | bool setDestDir, std::string const& tempInstallDirectory) |
| 503 | { |
| 504 | cmValue cmakeScripts = this->GetOption("CPACK_INSTALL_SCRIPTS"); |
| 505 | { |
| 506 | cmValue const cmakeScript = this->GetOption("CPACK_INSTALL_SCRIPT"); |
| 507 | if (cmakeScript && cmakeScripts) { |
| 508 | cmCPackLogger( |
| 509 | cmCPackLog::LOG_WARNING, |
| 510 | "Both CPACK_INSTALL_SCRIPTS and CPACK_INSTALL_SCRIPT are set, " |
| 511 | "the latter will be ignored." |
| 512 | << std::endl); |
| 513 | } else if (cmakeScript && !cmakeScripts) { |
| 514 | cmakeScripts = cmakeScript; |
| 515 | } |
| 516 | } |
| 517 | if (cmakeScripts && !cmakeScripts->empty()) { |
| 518 | cmCPackLogger(cmCPackLog::LOG_OUTPUT, |
| 519 | "- Install scripts: " << cmakeScripts << std::endl); |
| 520 | cmList cmakeScriptsVector{ cmakeScripts }; |
| 521 | for (std::string const& installScript : cmakeScriptsVector) { |
| 522 | |
| 523 | cmCPackLogger(cmCPackLog::LOG_OUTPUT, |
| 524 | "- Install script: " << installScript << std::endl); |
| 525 | |
| 526 | if (setDestDir) { |
| 527 | // For DESTDIR based packaging, use the *project* |
| 528 | // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The |
| 529 | // value of the project's CMAKE_INSTALL_PREFIX is sent in here as the |
| 530 | // value of the CPACK_INSTALL_PREFIX variable. |
| 531 | |
| 532 | std::string dir; |
| 533 | if (this->GetOption("CPACK_INSTALL_PREFIX")) { |
| 534 | dir += *this->GetOption("CPACK_INSTALL_PREFIX"); |
| 535 | } |
| 536 | this->SetOption("CMAKE_INSTALL_PREFIX", dir); |
| 537 | cmCPackLogger( |
| 538 | cmCPackLog::LOG_DEBUG, |
| 539 | "- Using DESTDIR + CPACK_INSTALL_PREFIX... (this->SetOption)" |
| 540 | << std::endl); |
| 541 | cmCPackLogger(cmCPackLog::LOG_DEBUG, |
| 542 | "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" |
| 543 | << std::endl); |
| 544 | } else { |
| 545 | this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory); |
| 546 | |
| 547 | cmCPackLogger(cmCPackLog::LOG_DEBUG, |
| 548 | "- Using non-DESTDIR install... (this->SetOption)" |
| 549 | << std::endl); |
| 550 | cmCPackLogger(cmCPackLog::LOG_DEBUG, |
| 551 | "- Setting CMAKE_INSTALL_PREFIX to '" |
| 552 | << tempInstallDirectory << "'" << std::endl); |
| 553 | } |
| 554 | |
| 555 | this->SetOptionIfNotSet("CMAKE_CURRENT_BINARY_DIR", |
| 556 | tempInstallDirectory); |
| 557 | this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR", |
| 558 | tempInstallDirectory); |
no test coverage detected