[CMake] cpack issues

Eric Noulard eric.noulard at gmail.com
Tue Feb 21 13:25:54 EST 2012


2012/2/21 Andrea Crotti <andrea.crotti.0 at gmail.com>:
> I'm trying to finally create an installer for my project, with CPack and
> NSIS.
>
> The project is really really simple, I just need to copy over a directory
> somewhere.
> And I did something like:
>
> get_filename_component(userprofile $ENV{USERPROFILE} REALPATH)
>
> install(
>  DIRECTORY ${EGG_BUILD_DIRECTORY}
>  DESTINATION ${userprofile}/${PROJECT_NAME}
>  )

Is "userprofile" an absolute path? (sorry I'm not working on Windows very often)
if this is the case this will not work.

DO NEVER install with absolute install path on Windows:
   1) the installed pieces won't be put in the installer
   2) the files/dirs/whatever MAY (if you have enough privilege) be
installed on the machine
       on which you are trying to build the package!!

I think we should forcibly forbid absolute install path on
windows...but that's another story.

> The first line is because CPack was exploding using the USERPROFILE, because
> it was getting non quoted backslash.
>
> So is it the way to handle windows path variables?

Usually you go from to native path representation using

file(TO_NATIVE_PATH path result)
file(TO_CMAKE_PATH path result)

see:
cmake --help-command file

> The packing, however, doesn't work and I get something like (from the NSIS
> generated log file):
>
> !insertmacro: end of MUI_RESERVEFILE_INSTALLOPTIONS
> Section: "-Core installation"
> SetOutPath: "$INSTDIR"
> File: Returning to: "H:/long_path/_CPack_Packages/win32/NSIS/Minimum
> Drag-0.1.1-win32"
> File: "H:/long_path/_CPack_Packages/win32/NSIS/Minimum Drag-0.1.1-win32\*.*"
> -> no files found.
> Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
>   /oname=outfile one_file_only)
> Error in script
> "H:/git_projs/Minimum_Drag/airbus.application.minimum_drag/_CPack_Packages/win32/NSIS/project.nsi"
> on line 640 -- aborting creation process
>
> These are the variables that I defined
> set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT_NAME}")

this one looks wrong:
CPACK_NSIS_INSTALLED_ICON_NAME
       A path to the executable that contains the installer icon.

> set(CPACK_PACKAGE_ICON "Company")

same for this one:
CPACK_PACKAGE_ICON
       A branding image that will be displayed inside the installer.

the documentation currently found  in CPack.cmake
or http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#NSIS
(and soon from cpack --help-variable)
could be improved but both the previous variables should refer to files.

> set(CPACK_NSIS_PACKAGE_NAME ${PROJECT_NAME})
>
> set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT.txt")
> set(CPACK_PACKAGE_VERSION_MAJOR 0)
> set(CPACK_PACKAGE_VERSION_MINOR 1)
> set(CPACK_CREATE_DESKTOP_LINKS "${PROJECT_NAME}")

I think this one refers to a executable installed by the project.
(but there is not documentation [yet] for "CPACK_CREATE_DESKTOP_LINKS" :-]

> set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}") # add the version
> numbers
> set(CPACK_PACKAGE_DESCRIPTION "Package ${PROJECT_NAME}")

there is no such variable.
There is:
CPACK_PACKAGE_DESCRIPTION_SUMMARY
       Short description of the project (only a few words).
CPACK_PACKAGE_DESCRIPTION_FILE
       A text file used to describe the project.

       Used, for example, the introduction screen of a CPack-generated
       Windows installer to describe the project.

> is there anything missing?
> Any idea what that could be?

A lot of things...
first did have a look at the error:
"H:/long_path/_CPack_Packages/win32/NSIS/Minimum Drag-0.1.1-win32\*.*"

is it true?

then open the project.nsi file and try to fix things "by hand".
then go back to your


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list