1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

Merge topic 'nsis-branding-trim-position'

f226a1678f Merge branch 'master' into nsis-branding-trim-position
a6a5256395 CPack: Validate and document NSIS branding text trim positions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5928
This commit is contained in:
Brad King
2021-03-25 14:23:12 +00:00
committed by Kitware Robot
2 changed files with 12 additions and 3 deletions

View File

@@ -193,6 +193,8 @@ on Windows Nullsoft Scriptable Install System.
.. versionadded:: 3.20
If set, trim down the size of the control to the size of the branding text string.
Allowed values for this variable are ``LEFT``, ``CENTER`` or ``RIGHT``.
If not specified, the default behavior is ``LEFT``.
.. variable:: CPACK_NSIS_EXECUTABLE

View File

@@ -215,9 +215,16 @@ int cmCPackNSISGenerator::PackageFiles()
if (this->IsSet("CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION")) {
std::string wantedPosition =
this->GetOption("CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION");
const std::set<std::string> possiblePositions{ "CENTER", "LEFT",
"RIGHT" };
if (possiblePositions.find(wantedPosition) != possiblePositions.end()) {
if (!wantedPosition.empty()) {
const std::set<std::string> possiblePositions{ "CENTER", "LEFT",
"RIGHT" };
if (possiblePositions.find(wantedPosition) ==
possiblePositions.end()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Unsupported branding text trim position "
<< wantedPosition << std::endl);
return false;
}
brandingTextPosition = wantedPosition;
}
}