[CMake] CMake, Cpack and NSIS woes.

Bill Hoffman bill.hoffman at kitware.com
Wed Oct 7 07:56:20 EDT 2009


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



More information about the CMake mailing list