Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
Community
Community
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • CMake
  • CommunityCommunity
  • Wiki
    • Doc
    • Cpack
  • Win32NewbiesChecklist

Win32NewbiesChecklist

Last edited by Kitware Robot Apr 27, 2018
Page history

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
  -
    <b>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](http://support.microsoft.com/kb/310519)</b>

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. Both the "CONFIGURATION" and the "COMPONENT" are optional. Using the COMPONENT Property will allow you to eventually do component based installs. See CMake:Component Install With CPack for more information.

There are ways to use Absolute file paths but there seems to be lots of issues with this approach and the approach is not supported on NSIS anyway. For more information on the subject take a look At this post on the CMake mailing list.


This page was initially populated by conversion from its original location in another wiki.

Clone repository
  • Contrib
  • Editing Guidelines
  • FAQ
  • Home
  • contrib/macros
    • AddCxxTest
    • CompareVersionStrings
    • CopyIfDifferent
    • CreateFinalFile
    • FilterOut
    • ForceAddFlags
    • GatherProjectFiles
    • GenerateProject
    • LibtoolFile
    • ListOperations
    • Merge
More Pages

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.