4

I am trying to get an installer compiled with NSIS on Windows 7 to work without administrator privileges. The project is set up with CMake and compiled with VC2010. I have figured out that I have to use the

RequestExecutionLevel user

option. My question is: What do I have to put into my CMakeLists.txt to pass this option to NSIS? I found

set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "RequestExecutionLevel user")

somewhere on google, but that gives an error, saying that this option cannot be set in this section.

Any help is greatly appreciated

sakra
  • 62,199
  • 16
  • 168
  • 151
Hans
  • 1,741
  • 3
  • 25
  • 38
  • 1
    I don't know CMake, but in NSIS, RequestExecutionLevel is installer attribute (not valid in the section). So you can put it anywhere in your script except in a section or function. Is that it? – zbynour Dec 16 '11 at 15:49

2 Answers2

6

The version of CMake that I have has @CPACK_NSIS_DEFINES@ in NSIS template, so adding set(CPACK_NSIS_DEFINES "RequestExecutionLevel user") to CMakeLists.txt does the job as well.

Although it may require extra work for component based install.

mlt
  • 1,595
  • 2
  • 21
  • 52
2

You can try following steps:

  1. Copy NSIS.template.in to your project directory, e.g. a subdirectory named "packaging":

    xcopy \cmake-install-path\modules\share\cmake-xxx\Modules\NSIS.template.in \your-project-directory\packaging\

  2. Add RequestExecutionLevel user to NSIS.template.in

  3. Update CMAKE_MODULE_PATH in CMakeLists.txt:

    list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/packaging)

Then rebuild your package to see if it works.

Deqing
  • 14,098
  • 15
  • 84
  • 131