[CMake] CMake, Cpack and NSIS woes.

Andrew Maclean andrew.amaclean at gmail.com
Tue Oct 6 18:55:21 EDT 2009


I am going to admit the possibility that I am doing something stupid.
If so please tell me what I am doing wrong!

In a nutshell:
Creating a windows package to install to a subdirectory does not work.
Also I don't think CPACK_NSIS_DISPLAY_NAME works.

In order to illustrate the problem I have attached a minimal example.
I am using a recent development version of CMake and NSIS 2.45 but
this problem does occur with CMake 2.6.4

I want to install the program into a directory that is a subdirectory
of C:\Program Files or /usr/local
When using the attached minimal example, the directory is: C:/Program
Files/VTK_Utilities/CMakeTest_1.1

It seems that that the install prefix is correct and the package
install directory is correct. I can install and uninstall it
correctly.

However when I create a package, C:\Program Files is appended to the
path and it looks like this:
C:\Program Files\C:/Program Files/VTK_Utilities/CMakeTest_1.1
The "\" is then treated as an escape character upon install, so the
path ends up as:
C:\Program Files\CProgram FilesVTK_UtilitiesCMakeTest_1.1
And the directory in the start menu becomes:
CProgram FilesVTK_UtilitiesCMakeTest_1.1

So the problem is that setting CPACK_PACKAGE_INSTALL_DIRECTORY to be
the CMAKE_INSTALL_PREFIX does not work for two reasons:
1) C:\Program Files\ seems to be automatically appended.
2) / are stripped out when logically I would expect them to be replaced by \.

When you run CMake, these are correct:
CMakeTest_INSTALL_PREFIX: C:/Program Files/VTK_Utilities/CMakeTest_1.1
CMAKE_INSTALL_PREFIX: C:/Program Files/VTK_Utilities/CMakeTest_1.1
CPACK_PACKAGE_INSTALL_DIRECTORY: C:/Program Files/VTK_Utilities/CMakeTest_1.1

But notice that the packager changes CPACK_PACKAGE_INSTALL_DIRECTORY
as evidenced by running the package.

Some other things I have tried:
1) Converting CMAKE_INSTALL_PREFIX to a native file path before
assigning to CPACK_PACKAGE_INSTALL_DIRECTORY.
2)   string(REPLACE "/" "\\\\" NATIVE_CMAKE_INSTALL_PATH
${CMAKE_INSTALL_PREFIX})
     set(CPACK_PACKAGE_INSTALL_DIRECTORY ${NATIVE_CMAKE_INSTALL_PATH}
CACHE INTERNAL "")
	 We still get C:\Program Files appended and the following warnings:
	
	 4>CMake Warning (dev) at
C:/Users/amaclean/Code/Miscellaneous/CMakeTest/build/CPackConfig.cmake:56
(SET):
	 4>  Syntax error in cmake code at
	 4>    C:/Users/amaclean/Code/Miscellaneous/CMakeTest/build/CPackConfig.cmake:56
	 4>  when parsing string
	 4>    C:\Program Files\VTK_Utilities\CMakeTest_1.1
	 4>  Invalid escape sequence \P
	 4>  Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
	 4>  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
	 4>  command to set the policy and suppress this warning.
	 4>This warning is for project developers.  Use -Wno-dev to suppress it.

     i.e. \P is being treated as an escape character.

Thanks in advance for any help.

Rgeards
   Andrew


-- 
___________________________________________
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/
___________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeTest.zip
Type: application/zip
Size: 5131 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091007/91e5b4a3/attachment.zip>


More information about the CMake mailing list