The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14522 
====================================================================== 
Reported By:                Mark Stijnman
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14522
Category:                   CPack
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-10-29 12:05 EDT
Last Modified:              2013-10-29 12:05 EDT
====================================================================== 
Summary:                    CPACK_NSIS_DEFINES doesn't work in component-based
installer
Description: 
I need to add some options to my NSIS installer, and noticed in the
NSIS.template.in there is a variable CPACK_NSIS_DEFINES that looked suitable.
Even though it doesn't appear to be documented, I've found mentions online of
users who have used this variable for similar purposes (for example
http://www.cmake.org/pipermail/cmake/2009-April/028592.html and
http://public.kitware.com/Bug/view.php?id=5939), so apparently this used to
work. However, it doesn't use for my project. When I tried to create a minimal
example, it worked again. Turns out that the problem only shows up when you use
a component-based installer. In that case, the contents of the
CPACK_NSIS_DEFINES variable don't make it into the project.nsi file at all. If I
check the source code in cmCPackNSISGenerator.cxx, I see that its value is
overwritten in function PackageFiles when components are present. 

Steps to Reproduce: 
Use the following as a CMakeLists.txt file:
--- CMakeLists.txt begin

cmake_minimum_required(VERSION 2.8)

project(cpack_nsis_defines_test)
set(test_file "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
file(WRITE ${test_file} "test")
install(FILES ${test_file} DESTINATION . COMPONENT test)
set(CPACK_COMPONENTS_ALL test)
set(CPACK_NSIS_DEFINES "  !define MUI_WELCOMEPAGE_TITLE_3LINES")
include(CPack)

--- CMakeLists.txt end

If you build the PACKAGE target, and run the installer, you will notice that the
MUI_WELCOMEPAGE_TITLE_3LINES didn't have any effect. If you check the
project.nsi file that is generated, you see that the
MUI_WELCOMEPAGE_TITLE_3LINES option is not there. If you comment out the
"CPACK_COMPONENTS_ALL" line, it will work as expected.

Additional Information: 
The issue can be fixed by modifying the PackageFile function such that any old
value of CPACK_NSIS_DEFINES is stored in the "defines" variable first, before
new values are appended to it. A patch is attached.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-10-29 12:05 Mark Stijnman  New Issue                                    
2013-10-29 12:05 Mark Stijnman  File Added: cpack_nsis_defines_fix.patch        
           
======================================================================

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to