<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi!<br><br>I have put together a custom way of building packages inspired by Stuart Herring posted here earlier:<br><br>Fri Apr 4 20:39:04 EDT 2008<br>[CMake] CPack: Building Multiple Packages<br><br>Everything is working fine with version 2.6.0 but things break up with 2.6.2. The<br>error I get is like:<br><br>CPack Error: Problem creating temporary directory: /opt/test<br><br>So, I'm not sure if there is a bug in 2.6.2 or has something changed between 2.6.0 and 2.6.2 which I don't take into account. <br><br>I have attached to this mail a tar package containing full example of the problem.<br><br>For those who can't bother with the tar file here is written out the CMakeLists.txt &amp; CPackConfig.in files, which make it all happen:<br><br>CMakeLists.txt:<br><br>#===============================================================================<br># Top level
 project makefile<br>#===============================================================================<br><br>CMAKE_MINIMUM_REQUIRED(VERSION 2.6)<br><br>PROJECT(test)<br><br>SET(VERSION_MAJOR 0)<br>SET(VERSION_MINOR 1)<br>SET(VERSION_PATCH 2)<br>SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")<br><br>#-------------------------------------------------------------------------------<br># macro for creating packages.<br>#-------------------------------------------------------------------------------<br><br>ADD_CUSTOM_TARGET(pack)<br><br>MACRO(ADD_PACKAGE COMPONENT)<br>&nbsp; SET(TARGET pack-${COMPONENT})<br>&nbsp; SET(CONFIG "CPackConfig-${COMPONENT}.cmake")<br>&nbsp; SET(PACKAGE ${COMPONENT})<br>&nbsp; CONFIGURE_FILE("CPackConfig.in" "${CONFIG}" @ONLY)<br>&nbsp; ADD_CUSTOM_TARGET(${TARGET} COMMAND cpack --config "${CONFIG}")<br>&nbsp; ADD_DEPENDENCIES(pack
 ${TARGET})<br>ENDMACRO(ADD_PACKAGE)<br><br>#-------------------------------------------------------------------------------<br># installation path settings<br>#-------------------------------------------------------------------------------<br><br>SET(CMAKE_SET_DESTDIR "ON")<br>SET(CMAKE_INSTALL_PREFIX "/opt/test")<br>SET(CPACK_GENERATOR "DEB" "RPM")<br><br>#-------------------------------------------------------------------------------<br># create test binary<br>#-------------------------------------------------------------------------------<br><br>ADD_EXECUTABLE(bin1 "bin1.cc")<br>INSTALL(TARGETS bin1 DESTINATION "bin" COMPONENT "binaries")<br>ADD_PACKAGE(binaries)<br><br>CPackConfig.in:<br><br>#===============================================================================<br># template for package generation<br>#===============================================================================<br><br>SET(CMAKE_SET_DESTDIR
 "@CMAKE_SET_DESTDIR@")<br>SET(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")<br>SET(CPACK_SET_DESTDIR "@CMAKE_SET_DESTDIR@")<br>SET(CPACK_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")<br><br>SET(CPACK_PACKAGE_VERSION_MAJOR @VERSION_MAJOR@)<br>SET(CPACK_PACKAGE_VERSION_MINOR @VERSION_MINOR@)<br>SET(CPACK_PACKAGE_VERSION_PATCH @VERSION_PATCH@)<br><br>SET(CPACK_CMAKE_GENERATOR "@CMAKE_GENERATOR@")<br>SET(CPACK_GENERATOR "@CPACK_GENERATOR@")<br><br>SET(CPACK_INSTALL_CMAKE_PROJECTS "@PROJECT_BINARY_DIR@;@PROJECT_NAME@;@PACKAGE@;/")<br>SET(CPACK_PACKAGE_FILE_NAME "@PROJECT_NAME@-@PACKAGE@-@VERSION@-@CMAKE_SYSTEM_NAME@")<br>SET(CPACK_PACKAGE_NAME "@PROJECT_NAME@")<br>SET(CPACK_PACKAGE_VENDOR "Test Vendor")<br>SET(CPACK_PACKAGE_CONTACT "test@vendor.org")<br>SET(CPACK_PACKAGE_DESCRIPTION_FILE "@PROJECT_BINARY_DIR@/Description.txt")<br>SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test @PACKAGE@ Package")<br>SET(CPACK_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")<br><br>and finally
 here is the output I get with cmake 2.6.0 and 2.6.2<br><br>Best regards,<br>Petri Hodju<br><br>--------------------------- with cmake 2.6.0 ---------------------------------<br><br>pho@host:~/misc/code/cpack$ cmake --version<br>cmake version 2.6-patch 0<br><br>pho@host:~/misc/code/cpack$ cpack --version<br>cpack version 2.6-patch 0<br><br>pho@host:~/misc/code/cpack$ cmake .<br>-- The C compiler identification is GNU<br>-- The CXX compiler identification is GNU<br>-- Check for working C compiler: /usr/bin/gcc<br>-- Check for working C compiler: /usr/bin/gcc -- works<br>-- Detecting C compiler ABI info<br>-- Detecting C compiler ABI info - done<br>-- Check for working CXX compiler: /usr/bin/c++<br>-- Check for working CXX compiler: /usr/bin/c++ -- works<br>-- Detecting CXX compiler ABI info<br>-- Detecting CXX compiler ABI info - done<br>-- Configuring done<br>-- Generating done<br>-- Build files have been written to:
 /home/pho/misc/code/cpack<br><br>pho@host:~/misc/code/cpack$ make<br>Scanning dependencies of target bin1<br>[100%] Building CXX object CMakeFiles/bin1.dir/bin1.cc.o<br>Linking CXX executable bin1<br>[100%] Built target bin1<br><br>pho@host:~/misc/code/cpack$ make pack<br>Scanning dependencies of target pack-binaries<br>CPack: Create package using DEB<br>CPack: Install projects<br>CPack: - Run preinstall target for: test<br>CPack: - Install project: test<br>CPack: Compress package<br>CPack: Finalize package<br>CPack: Package /home/pho/misc/code/cpack/test-binaries-0.1.2-Linux.deb generated.<br>CPack: Create package using RPM<br>CPack: Install projects<br>CPack: - Run preinstall target for: test<br>CPack: - Install project: test<br>CPack: Compress package<br>CPack: Finalize package<br>CPack: Package /home/pho/misc/code/cpack/test-binaries-0.1.2-Linux.rpm generated.<br>Built target pack-binaries<br>Scanning dependencies of target pack<br>Built target
 pack<br><br>--------------------------- with cmake 2.6.2 ---------------------------------<br><br>pho@host:~/misc/code/cpack$ cmake --version<br>cmake version 2.6-patch 2<br><br>pho@host:~/misc/code/cpack$ cpack --version<br>cpack version 2.6-patch 2<br><br>pho@host:~/misc/code/cpack$ cmake .<br>-- The C compiler identification is GNU<br>-- The CXX compiler identification is GNU<br>-- Check for working C compiler: /usr/bin/gcc<br>-- Check for working C compiler: /usr/bin/gcc -- works<br>-- Detecting C compiler ABI info<br>-- Detecting C compiler ABI info - done<br>-- Check for working CXX compiler: /usr/bin/c++<br>-- Check for working CXX compiler: /usr/bin/c++ -- works<br>-- Detecting CXX compiler ABI info<br>-- Detecting CXX compiler ABI info - done<br>-- Configuring done<br>-- Generating done<br>-- Build files have been written to: /home/pho/misc/code/cpack<br><br>pho@host:~/misc/code/cpack$ make<br>Scanning dependencies of target bin1<br>[100%]
 Building CXX object CMakeFiles/bin1.dir/bin1.cc.o<br>Linking CXX executable bin1<br>[100%] Built target bin1<br><br>pho@host:~/misc/code/cpack$ make pack<br>Scanning dependencies of target pack-binaries<br>CPack: Create package using DEB<br>CPack: Install projects<br>CPack: - Run preinstall target for: test<br>CPack: - Install project: test<br>CPack Error: Problem creating temporary directory: /opt/test<br>CPack Error: Error when generating package: test<br>make[3]: *** [CMakeFiles/pack-binaries] Error 1<br>make[2]: *** [CMakeFiles/pack-binaries.dir/all] Error 2<br>make[1]: *** [CMakeFiles/pack.dir/rule] Error 2<br>make: *** [pack] Error 2<br></td></tr></table><br>