CMake:CPackWin32NewbiesChecklist

From KitwarePublic
Revision as of 16:02, 2 July 2008 by Imikejackson@gmail.com (talk | contribs) (New page: I just wanted to jot down some notes that I took during my "learning curve" of CPack on Windows XP.<br> <br>First, what would seem like obvious things to do but worth mentioning. = Pre-r...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

I just wanted to jot down some notes that I took during my "learning curve" of CPack on Windows XP.


First, what would seem like obvious things to do but worth mentioning.

Pre-requisite Software

  1. Download and install the NSIS installer from NSIS Downloads page
  2. Download and install a Zip package. I used 7zip from 7Zip Downloads page
After you install 7zip (or what ever package you want for zip compression) be sure to add that program to the "PATH" variable for windows.
Instructions for that can be found at Microsoft's web site How To Manage Environment Variables in Windows XP

Now you should be ready to start writing some CPack Code.

Bumps in the Road

Early on I had some trouble getting some support libraries to show up in the installer. This was because of a bug in my own cmake code which I thought might be good to show here so that others do not make the same mistake.

WRONG CMAKE CODE

    INSTALL(FILES MyLibrary.dll 
       DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 
       CONFIGURATIONS Debug 
       COMPONENT Runtime)

Note the ${CMAKE_INSTALL_PREFIX} in the Destination property. Having this was a bug and caused all sorts of problems. Basically CPack runs the "install" command first and then does the packaging. By using an Absolute path in the "Destination" property CMake was dutifully copying the files into the installation directory and NOT the staging area for CPack. OOPS. Here is the corrected code.

CORRECT CMAKE CODE

    INSTALL(FILES MyLibrary.dll 
       DESTINATION bin 
       CONFIGURATIONS Debug 
       COMPONENT Runtime)

Also note that I am using a "CONFIGURATION" property because I actually name outputs based on the build configuration.