[CMake] TGZ installer following links

Eric Noulard eric.noulard at gmail.com
Tue Jun 21 11:29:46 EDT 2011


2011/6/21 John R. Cary <cary at txcorp.com>:
> On 6/21/11 6:28 AM, Brad King wrote:
>>
>> On 06/17/2011 04:59 PM, Eric Noulard wrote:
>>>
>>> OK I have the same behavior on my box using your example.
>>> I did open a bug report:
>>> http://public.kitware.com/Bug/view.php?id=12284
>>
>> I posted an explanation here:
>>
>>   http://www.cmake.org/Bug/view.php?id=12284#c26931
>>
>> CPack recursively collects all *files* in the installation tree and hands
>> them as individual paths to the archive tool.  Therefore it walks through
>> the directory symlink and collects the files inside.  This has existed in
>> every version of CPack both before and after the switch to libarchive.
>
> Just in case anyone is interested, here is my workaround:
>
>  add_custom_target(bindist
>    COMMAND ${CMAKE_MAKE_PROGRAM} package
>    COMMAND tar czf ${FLAVOR_PACKAGE_NAME}.tar.gz -C
> ${CMAKE_BINARY_DIR}/_CPack_Packages/${CMAKE_SYSTEM_NAME}/TGZ
> ${FLAVOR_PACKAGE_NAME}
>    COMMAND rm
> ${CMAKE_BINARY_DIR}/_CPack_Packages/${CMAKE_SYSTEM_NAME}/TGZ/${FLAVOR_PACKAGE_NAME}.tar.gz
>  )


If you want a more portable solution you may use "cmake -E" commands
instead of native tar & rm.

add_custom_target(bindist
    COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_BINARY_DIR} package
    COMMAND ${CMAKE_COMMAND} -E tar czf
${CMAKE_BINARY_DIR}/${FLAVOR_PACKAGE_NAME}.tar.gz
${FLAVOR_PACKAGE_NAME}
    COMMAND  ${CMAKE_COMMAND} -E remove -f ${FLAVOR_PACKAGE_NAME}.tar.gz
    WORKING_DIRECTORY
${CMAKE_BINARY_DIR}/_CPack_Packages/${CMAKE_SYSTEM_NAME}/TGZ
 )


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list