[CMake] Make NSIS generator generate installer that requires admin or power user

Mattias Helsing helsing72 at gmail.com
Tue Jan 31 18:06:17 EST 2012


Hi,

I'm a user of the NSIS generator of CPack to generate nice windows
installers. Often lately I have embedded external installers with my
installer and then run them as part of my installer. This is working
really nice except for one thing; if you need to install drivers or
services the entire installer will require admin or power user
privileges. Thus I need to stop both the installer and the uninstaller
from running early if the user running it doesn't have proper
privileges. Until now I have manually post edited the generated
project.nsi file to add this functionlity and regenerated the
installer.
Now I hope that someone else is embedding external installers with
their installers and propose a new feature. It optionally adds an
abort message and installer abort if one sets
CPACK_NSIS_REQUIRE_POWERUSER prior to include(CPack).
Attached patch is against cmake master. In CPack.cmake it sets
CPACK_NSIS_REQUIRE_POWERUSER to "ON" if a user have defined or set
CPACK_NSIS_REQUIRE_POWERUSER to anything. This is because the NSIS
scripting language is assembler-like and I string compare (StrCmp) the
value of said variable to "ON" to perform a relative jump. Not setting
CPACK_NSIS_REQUIRE_POWERUSER will generate the same installer as
NSIS.template.in has generated since cmake 2.6. Feedback welcome.

cheers
Mattias


More information about the CMake mailing list