CPack --trace and --trace-expand options expect arguments since 3.24.0
CMake was recently upgraded to from 3.16.3
to 3.24.2
on a machine that I use for CI.
There is a packaging process that uses cpack
, invoked with cpack --trace --verbose
. Since the upgrade this call has failed, claiming --trace
option needs an argument.
Below are some examples of expected and observed behaviour when invoking cpack --trace
(note cpack is expected to fail due to invalid configuration)
Examples
Output prior to upgrade
cpack fails (expected, due to no generator) but trace is emitted:
~ cmake --version
cmake version 3.16.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
~ cpack --version
cpack version 3.16.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
~ cpack --trace
/usr/local/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake(34): if(CMAKE_HOST_UNIX )
/usr/local/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake(35): find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
***** [ OMITTED FOR BREVITY ] *****
/usr/local/share/cmake-3.16/Modules/CMakeSystemSpecificInformation.cmake(54): set(CMAKE_SHARED_MODULE_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX} )
/usr/local/share/cmake-3.16/Modules/CMakeSystemSpecificInformation.cmake(58): set(CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED 1 )
CPack Error: CPack generator not specified
Output after upgrade
cpack fails when parsing command line, compains about --trace
~ cmake --version
cmake version 3.24.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
~ cpack --version
cpack version 3.24.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
~ cpack --trace
CMake Error: Invalid value used with --trace
Output after upgrade with workaround
~ cpack --version
cpack version 3.16.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
~ cpack --trace any_old_string
/usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/CMakeDetermineSystem.cmake(35): if(CMAKE_HOST_UNIX )
/usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/CMakeDetermineSystem.cmake(36): find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
***** [ OMITTED FOR BREVITY ] *****
/usr/local/share/cmake-3.16/Modules/CMakeSystemSpecificInformation.cmake(58): set(CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED 1 )
CPack Error: CPack generator not specified
Possible cause
The commit 87c762d435470ef50d1c9ee14f1b34aaf0a84767
may have introduced this issue.
Prior to the commit, the --trace
argument in Source/CPack/cpack.cxx
takes no arguments:
arg.AddArgument("--trace", argT::NO_ARGUMENT, &trace,
"Put underlying cmake scripts in trace mode.");
After the commit, the --trace
argument takes a single argument:
CommandArgument{ "--trace", CommandArgument::Values::One, traceLambda },
The traceLambda
function explicitly ignores the command argument function