I have the following CMakeLists.txt (the only thing in the directory):
cmake_minimum_required(VERSION 3.0.0)
project(CPackUninstallerTest)
set(CPACK_GENERATOR NSIS)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
"DetailPrint \\\"Sleeping...\\\"
Sleep 3000"
)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test.txt" "Some output\n")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/test.txt" TYPE DATA)
include(CPack)
Running cmake and cpack works fine, and .../build/CPackUninstallerTest-0.1.1-win64.exe is generated.
Running the installer works as expected:
And running the uninstaller (Uninstall.exe in the install directory) also works, where the sleep takes three seconds:
However, this uninstall window does not show up if I try to install on top of an existing installation. After clicking Yes here:
That window goes away for three seconds (as it uninstalls) before the new installer runs.
This is a terrible user experience and results in them re-running the installer while waiting for the hidden uninstaller, causing confusing results.
How do I configure NSIS or CMake/CPack to show the uninstaller progress bar when using CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL and re-installing?


