[CMake] CPack Windows default CPACK_NSIS_INSTALL_ROOT

Hugh h.sorby at auckland.ac.nz
Mon Jun 10 05:43:08 EDT 2013


I didn't explain it very well but I have submitted a bug report and a 
patch resolution file here:

http://public.kitware.com/Bug/view.php?id=14211

if anyone is interested in the outcome.

Thanks Eric.

On 10/06/2013 7:21 p.m., Eric Noulard wrote:
> 2013/6/10 Hugh <h.sorby at auckland.ac.nz>:
>> Hi,
>>
>> I am using CPack to package a 64 bit library using the NSIS CPack generator
>> and I am getting the "C:\Program Files (x86)\" as the default
>> CPACK_NSIS_INSTALL_ROOT value.  I was expecting to get "C:\Program Files\".
>> Is this the expected behaviour?
> I guess, this is the historical behavior.
>
> CPACK_NSIS_INSTALL_ROOT is (indirectly) set to "$PROGRAMFILES" (have a
> look in CPack.cmake).
>
> This "PROGRAMFILES" variable is an NSIS var, whose value corresponds
> to what you observed:
> http://stackoverflow.com/questions/9087538/is-programfiles-a-constant-declared-in-nsis-or-is-it-the-environment-variable-r
>
> You can do something like the following in your CMakeLists.txt:
>    if(CMAKE_CL_64)
>      set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
>      set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} (Win64)")
>      set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}
> ${CPACK_PACKAGE_VERSION} (Win64)")
>    else()
>      set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
>      set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
>      set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}
> ${CPACK_PACKAGE_VERSION}")
>    endif()
>
> This is an excerpt from CMakeCPack.cmake found in CMake source tree.
>
> If this default behavior is buggy, then may be you can propose a
> patch, explaining why this is buggy.
>
> --
> Erk
> L'élection n'est pas la démocratie -- http://www.le-message.org



More information about the CMake mailing list