From d927e2ba752487913ae47d1713611a3b28101b7f Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 12 Apr 2026 16:13:29 -0600 Subject: [PATCH] CMAKE: Conditionally add value of CPACK_BUILD_CONFIG to package name This is an undocumented variable that will hold the build configuration, e.g. Debug, Release, etc., used to create a package with CPack. It is only set if you provide an explicit configuration argument to CPack. --- cmake/cpack-setup.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/cpack-setup.cmake b/cmake/cpack-setup.cmake index 400c2aad3..75d2cb9b9 100644 --- a/cmake/cpack-setup.cmake +++ b/cmake/cpack-setup.cmake @@ -39,7 +39,11 @@ else () list(APPEND buildSuffix "win32") endif () - list(APPEND buildSuffix "\${CPACK_BUILD_CONFIG}") + # Append -C argument to CPack, if not empty + if (CPACK_BUILD_CONFIG) + list(APPEND buildSuffix "${CPACK_BUILD_CONFIG}") + endif () + ## If using Visual Studio, append the compiler and toolkit: if (CMAKE_GENERATOR MATCHES "Visual Studio 17 .*") list(APPEND buildSuffix "vs2022")