diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-03-24 04:43:21 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-03-24 05:35:29 (GMT) |
commit | a6a52563955a5a42e1fec856d65479444ba5fbdc (patch) | |
tree | e9f8c1124d49cc99b129e486b38eeb5ff9548746 | |
parent | b7b0fb430397bafae4a7bd80b41d474c91a3b7f3 (diff) | |
download | CMake-a6a52563955a5a42e1fec856d65479444ba5fbdc.zip CMake-a6a52563955a5a42e1fec856d65479444ba5fbdc.tar.gz CMake-a6a52563955a5a42e1fec856d65479444ba5fbdc.tar.bz2 |
CPack: Validate and document NSIS branding text trim positions
-rw-r--r-- | Help/cpack_gen/nsis.rst | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst index eaef8ae..de1f3b5 100644 --- a/Help/cpack_gen/nsis.rst +++ b/Help/cpack_gen/nsis.rst @@ -193,3 +193,5 @@ 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``. diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 263adfd..f1cc677 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -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; } } |