[CMake] CMake, Cpack and NSIS woes.

David Cole david.cole at kitware.com
Mon Oct 12 15:56:45 EDT 2009


I reproduced this. In the CPackConfig.cmake that ends up in the binary tree,
the following contents are found:

SET(CPACK_NSIS_DISPLAY_NAME "MyStuff\CMakeTest 1.1")
SET(CPACK_NSIS_PACKAGE_NAME "MyStuff\CMakeTest 1.1")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "MyStuff\\CMakeTest 1.1")

The display name and package name values are not properly escaped... they
come from the default value for CPACK_PACKAGE_INSTALL_DIRECTORY, but that
cannot contain backslashes because then variables go through multiple levels
of escaping. So....

my recommendation is to leave CPACK_PACKAGE_INSTALL_DIRECTORY at its default
value and not put any backslashes in it. Then change it inside your
CPackOptions.cmake.in file along with the NSIS variables you are already
setting.

If I comment out line 23 of CMakeFiles/CPack.cmake, then the NSIS package
builds successfully. Then you can tweak from there (I hope!) to get your
desired settings.


Hope this helps,
David


On Mon, Oct 12, 2009 at 1:09 AM, Andrew Maclean
<andrew.amaclean at gmail.com>wrote:

> CPack woes continued!
>
> I implemented it the way you recommended to avoid \\\\ hell.
> You can unzip the attachment and try it out.
>
> ... And it almost works.
> I can install/uninstall into C:\Program Files\MyStuff\CMakeTest 1.1
> I can create an NSIS package that installs/uninstalls into C:\Program
> Files\MyStuff\CMakeTest 1.1 and sets the Start Menu to
> MyStuff\CMakeTest 1.1.
>
> But it is not quite correct ...
>
> When I look at CpackConfig.cmake,
> SET(CPACK_NSIS_DISPLAY_NAME "MyStuff\CMakeTest 1.1")
> SET(CPACK_NSIS_PACKAGE_NAME "MyStuff\CMakeTest 1.1")
> Are set to the same value even though in CPackOptions.cmake.in
>  set(CPACK_NSIS_DISPLAY_NAME "CMakeTest
> @CMakeTest_VERSION_MAJOR at .@CMakeTest_VERSION_MINOR@ some sort of
> program.")
>  set(CPACK_NSIS_PACKAGE_NAME "@MY_INSTALL_DIRECTORY@\\CMakeTest
> @CMakeTest_VERSION_MAJOR at .@CMakeTest_VERSION_MINOR@")
>
> Manually changing CPACK_NSIS_DISPLAY_NAME  and CPACK_NSIS_PACKAGE_NAME
>  has no effect.
>
>
>
>
> Also
> CMake Warning (dev) at
> C:/Users/amaclean/Code/Projects/CPP/CMakeTest/build/CPackConfig.cmake:54
> (SET):
> 3>  Syntax error in cmake code at
> 3>
>  C:/Users/amaclean/Code/Projects/CPP/CMakeTest/build/CPackConfig.cmake:54
> 3>  when parsing string
> 3>    MyStuff\CMakeTest 1.1
> 3>  Invalid escape sequence \C
> 3>  Policy CMP0010 is not set: Bad variable reference syntax is an error.
>  Run
> 3>  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
> 3>  command to set the policy and suppress this warning.
> 3>This warning is for project developers.  Use -Wno-dev to suppress it.
> 3>CPack: Create package using NSIS
>
> This should not happen as "MyStuff\CMakeTest 1.1" is a valid
> subdirectory name in windows.
> Additionally setting
> cmake_policy(SET CMP0010 OLD)
> in the top-level CMake file has no effect. The same message as above
> occurs whether old or new is set.
>
>
> I am using CMake 2.9.20091009
> I am also making sure to delete the whole build directory each time.
>
>
> Regards
>    Andrew
>
>
>
> On Thu, Oct 8, 2009 at 9:12 AM, Andrew Maclean
> <andrew.amaclean at gmail.com> wrote:
> > Thankyou very much for this hint. I will try it out.
> >
> > Regards
> >   Andrew
> >
> >
> > On Wed, Oct 7, 2009 at 10:56 PM, Bill Hoffman <bill.hoffman at kitware.com>
> wrote:
> >> Andrew Maclean wrote:
> >>>
> >>> The only way that I can get this to work is to do this:
> >>>
> >>>  string(REPLACE "/" "\\\\" NATIVE_CMAKE_INSTALL_PATH
> ${INSTALL_DIRECTORY})
> >>>  set(CPACK_PACKAGE_INSTALL_DIRECTORY ${NATIVE_CMAKE_INSTALL_PATH}
> >>> CACHE INTERNAL "")
> >>
> >> So, to avoid \\\\\\ hell with CPack, you can do what we do in CMake:
> >>
> >> We configure the CPackOptions into a file:
> >>
> >>  CONFIGURE_FILE("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
> >>    "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
> >>  SET(CPACK_PROJECT_CONFIG_FILE
> >> "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
> >> # then set this CPack variable before including CPack
> >>  SET(CPACK_PROJECT_CONFIG_FILE
> >> "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
> >>
> >> The problem with CPack is that the variables get run through the CMake
> >> parser too many times.   By using the CPACK_PROJECT_CONFIG_FILE, that
> file
> >> gets included at CPack time and only has one CMake parse on the
> variables
> >> inside it.
> >>
> >> I will look at the DESTDIR issue with NSIS...
> >>
> >>
> >>
> >> -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
> >>
> >
> >
> >
> > --
> > ___________________________________________
> > Andrew J. P. Maclean
> > Centre for Autonomous Systems
> > The Rose Street Building J04
> > The University of Sydney  2006  NSW
> > AUSTRALIA
> > Ph: +61 2 9351 3283
> > Fax: +61 2 9351 7474
> > URL: http://www.acfr.usyd.edu.au/
> > ___________________________________________
> >
>
>
>
> --
> ___________________________________________
> Andrew J. P. Maclean
> Centre for Autonomous Systems
> The Rose Street Building J04
> The University of Sydney  2006  NSW
> AUSTRALIA
> Ph: +61 2 9351 3283
> Fax: +61 2 9351 7474
> URL: http://www.acfr.usyd.edu.au/
> ___________________________________________
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091012/861db816/attachment.htm>


More information about the CMake mailing list