[CMake] [CPack] CPackConfig.cmake vs CPackSourceConfig.cmake

Eric Noulard eric.noulard at gmail.com
Fri Apr 13 06:49:36 EDT 2007


2007/4/13, Mathieu Malaterre <mathieu.malaterre at gmail.com>:
> Hello,
>
>   I have the following custom target:
>
> ADD_CUSTOM_TARGET(data_tgz
>   COMMAND cpack -G TGZ --config CPackConfig.cmake
>   COMMAND ${CMAKE_COMMAND} -E copy
> ${CMAKE_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.tar.gz
> ${CMAKE_BINARY_DIR}/data.tar.gz
> )
>
>   Basically a deb package expect a file named 'data.tar.gz' to
> contains all the libs/bin in it. For some reason
> CPACK_PACKAGE_FILE_NAME is being expanded as using value from
> CPackSourceConfig.cmake instead of CPackConfig.cmake.

CPACK_PACKAGE_FILE_NAME is built when you
INCLUDE(CPack)

(unless you set the value yourself before the INCLUDE)

see: /usr/share/cmake-2.4/Modules/CPack.cmake

The var name is shared for SOURCE and BINARY package
there is a CPACK_SOURCE_PACKAGE_FILE_NAME
but no
CPACK_BINARY_PACKAGE_FILE_NAME :(((

You may get the "real" binary package file name if you
INCLUDE(CPackConfig.cmake)
just before your ADD_CUSTOM_COMMAND definition.

this will set the CPACK_PACKAGE_FILE_NAME
to the expected value.

>   How was I suposed to write this custom target instead ?

I really don't know and my proposition may break
the rest of your CMakeLists.txt if it expects
CPACK_PACKAGE_FILE_NAME to be the SOURCE package filename.

-- 
Erk


More information about the CMake mailing list