diff options
author | Nils Gladitz <n.gladitz@abberior-instruments.com> | 2021-05-19 10:10:58 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-05-23 22:21:49 (GMT) |
commit | 26e36111d326bbf69f437ef1335423ea3b2835e2 (patch) | |
tree | badbd556c99870e9729e9fdc84eb304d70d34876 /Source/CPack | |
parent | d98a7cdb25611ed6f1e856fd4c4ff980225b89cd (diff) | |
download | CMake-26e36111d326bbf69f437ef1335423ea3b2835e2.zip CMake-26e36111d326bbf69f437ef1335423ea3b2835e2.tar.gz CMake-26e36111d326bbf69f437ef1335423ea3b2835e2.tar.bz2 |
CPack: Implement new variable CPACK_CUSTOM_INSTALL_VARIABLES
The new variable allows projects to define custom key=value pairs of
variables to be set in CPack cmake_install.cmake script invocations.
This allows install(SCRIPT|CODE) to be parameterized at runtime.
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index cd2adaa..00e274d 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -902,6 +902,23 @@ int cmCPackGenerator::InstallCMakeProject( this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) { mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); } + + std::vector<std::string> custom_variables; + this->MakefileMap->GetDefExpandList("CPACK_CUSTOM_INSTALL_VARIABLES", + custom_variables); + + for (auto const& custom_variable : custom_variables) { + std::string value; + + auto i = custom_variable.find('='); + + if (i != std::string::npos) { + value = custom_variable.substr(i + 1); + } + + mf.AddDefinition(custom_variable.substr(0, i), value); + } + // do installation bool res = mf.ReadListFile(installFile); // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES |