[CMake] CPack - skipping licensing screen

Daniel Blezek Blezek.Daniel at mayo.edu
Fri Apr 24 16:24:27 EDT 2009


Hi Bill, James,

  Easier than I expected.  If CPACK_RESOURCE_FILE_LICENSE is not defined,
set CPACK_RESOURCE_FILE_LICENSE_PROVIDED to 0, add a !if macro to the NSIS
installer script and happiness ensues.

  Here's the patch, the change worked in my installed version of CMake, but
I didn't run the tests.

-dan

Index: Modules/CPack.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CPack.cmake,v
retrieving revision 1.43
diff -u -r1.43 CPack.cmake
--- Modules/CPack.cmake 5 Mar 2009 15:08:03 -0000       1.43
+++ Modules/CPack.cmake 24 Apr 2009 20:21:50 -0000
@@ -641,8 +641,15 @@
 
 cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
   "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
-cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
-  "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
+
+if ( NOT DEFINED CPACK_RESOURCE_FILE_LICENSE )
+  set(CPACK_RESOURCE_FILE_LICENSE
+    "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
+  set(CPACK_RESOURCE_FILE_LICENSE_PROVIDED "0")
+else ( NOT DEFINED CPACK_RESOURCE_FILE_LICENSE )
+  set(CPACK_RESOURCE_FILE_LICENSE_PROVIDED "1")
+endif ( NOT DEFINED CPACK_RESOURCE_FILE_LICENSE )
+
 cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
   "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
 cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
Index: Modules/NSIS.template.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/NSIS.template.in,v
retrieving revision 1.36
diff -u -r1.36 NSIS.template.in
--- Modules/NSIS.template.in    7 Apr 2009 19:31:51 -0000       1.36
+++ Modules/NSIS.template.in    24 Apr 2009 20:21:50 -0000
@@ -516,7 +516,9 @@
 ;Pages
   !insertmacro MUI_PAGE_WELCOME
 
-  !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
+  !if @CPACK_RESOURCE_FILE_LICENSE_PROVIDED@
+    !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
+  !endif
   Page custom InstallOptionsPage
   !insertmacro MUI_PAGE_DIRECTORY
   


  


On 4/24/09 11:39 AM, "Bill Hoffman" <bill.hoffman at kitware.com> wrote:

> James Bigler wrote:
>> On Fri, Apr 24, 2009 at 7:07 AM, Daniel Blezek <Blezek.Daniel at mayo.edu>
>> wrote:
>>> Hi,
>>> 
>>>   I¹m not sure if there is a CPack-specific mailing list, direct me if I¹m
>>> wrong.
>>> 
>>>   I find the empty license screen a little annoying in the NSIS installer
>>> for windows.  This occurs when you don¹t specify a license file for your
>>> installer.  CPack generates one for you, but a better behavior would be to
>>> skip that step of the install entirely.
>>> 
>>>   Is this an easy fix?
>>> 
>>> Thanks,
>>> -dan
>> 
>> Depends on your definition of easy.  The NSIS installer is script
>> based.  The script that is used to generate the installer is found in
>> the Modules/NSIS.template.in file.  In that file you will see a pages
>> section:
>> 
>> ;--------------------------------
>> ;Pages
>>   !insertmacro MUI_PAGE_WELCOME
>> 
>>   !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
>>   Page custom InstallOptionsPage
>>   !insertmacro MUI_PAGE_DIRECTORY
>> 
>>   ;Start Menu Folder Page Configuration
>> ...
>> 
>> See the insertmacro MUI_PAGE_LICENSE line?  That's the one that
>> inserts the license dialog in your installer.  You can see the
>> documentation for these pages here:
>> http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html
>> 
>> Unfortunately, I don't see an option to deactivate a MUI page after
>> you inserted it.  There could be one (I'm only just learning NSIS
>> script).
>> 
>> You have a some of options at this point that increase in complexity
>> and time to solution.
>> 
>> 1. Edit your installed copy of NSIS.template.in to exclude that page.
>> Easiest to do, but least maintainable or portable.
>> 2. Copy NSIS.template.in and somehow get CMake/CPack to use that
>> version instead of the installed version.  You have to maintain your
>> own copy, but it should be portable.
> 
> All you have to do is use CMAKE_MODULE_PATH to change to a different
> NSIS.template.in file.
> 
> 
>> 3. Submit a patch to CMake that makes that page optional (say for
>> example if you don't specify a license file).  Everyone gets to
>> benefit, but you have to put in the effort and wait for a release or
>> use a nightly.
> That would be good as well.
> 
> -Bill
> _______________________________________________
> 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://www.cmake.org/mailman/listinfo/cmake

-- 
Daniel Blezek, PhD
Medical Imaging Informatics Innovation Center

P 127 or (77) 8 8886
T 507 538 8886
E blezek.daniel at mayo.edu

Mayo Clinic
200 First St. S.W.
Harwick SL-44
Rochester, MN 55905
mayoclinic.org


-------------- next part --------------
A non-text attachment was scrubbed...
Name: NSISNoLicenseFile.patch
Type: application/octet-stream
Size: 1727 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090424/91601650/attachment.obj>


More information about the CMake mailing list