@ -1443,6 +1443,7 @@ macro( tde_create_tarball )
unset ( _files )
unset ( _destination )
set ( _sourcedir "${CMAKE_CURRENT_SOURCE_DIR}" )
set ( _compression "gzip" )
set ( _var _target )
foreach ( _arg ${ ARGN } )
@ -1475,6 +1476,13 @@ macro( tde_create_tarball )
set ( _directive 1 )
endif ( )
# f o u n d d i r e c t i v e " C O M P R E S S I O N "
if ( "+${_arg}" STREQUAL "+COMPRESSION" )
unset ( _compression )
set ( _var _compression )
set ( _directive 1 )
endif ( )
# c o l l e c t d a t a
if ( _directive )
unset ( _directive )
@ -1497,6 +1505,39 @@ macro( tde_create_tarball )
list ( APPEND _files_deps "${_sourcedir}/${_file}" )
endforeach ( )
if ( NOT DEFINED TAR_EXECUTABLE )
find_program ( TAR_EXECUTABLE NAMES tar )
if ( "${TAR_EXECUTABLE}" STREQUAL "TAR_EXECUTABLE-NOTFOUND" )
tde_message_fatal ( "tar executable is required but not found on your system" )
endif ( )
endif ( )
if ( NOT DEFINED TAR_SETOWNER )
execute_process (
C O M M A N D $ { T A R _ E X E C U T A B L E } - - v e r s i o n
O U T P U T _ V A R I A B L E T A R _ V E R S I O N
)
string ( REGEX REPLACE "^([^\n]*)\n.*" "\\1" TAR_VERSION "${TAR_VERSION}" )
if ( "${TAR_VERSION}" MATCHES "GNU *tar" )
set ( TAR_SETOWNER "--owner=root;--group=root" )
elseif ( "${TAR_VERSION}" MATCHES "bsd *tar" )
set ( TAR_SETOWNER "--uname=root;--gname=root" )
else ( )
set ( TAR_SETOWNER "" )
endif ( )
endif ( )
if ( "${_compression}" STREQUAL "-" )
unset ( _compression )
endif ( )
if ( _compression )
if ( "${_compression}" STREQUAL "gzip" )
set ( _compression "-z" )
else ( )
set ( _compression "--use-compress-program=\" ${ _compression } \"" )
endif ( )
endif ( )
get_filename_component ( _target_path "${CMAKE_CURRENT_BINARY_DIR}/${_target}" ABSOLUTE )
file ( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_path}" )
string ( REPLACE "/" "+" _target_name "${_target_path}" )
@ -1504,7 +1545,8 @@ macro( tde_create_tarball )
D E P E N D S " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { _ t a r g e t } " )
add_custom_command (
C O M M A N D $ { C M A K E _ C O M M A N D } - E t a r " c f z " " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { _ t a r g e t } " - - $ { _ f i l e s }
C O M M A N D $ { T A R _ E X E C U T A B L E } c f $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { _ t a r g e t }
$ { _ c o m p r e s s i o n } $ { T A R _ S E T O W N E R } - - $ { _ f i l e s }
W O R K I N G _ D I R E C T O R Y " $ { _ s o u r c e d i r } "
O U T P U T " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { _ t a r g e t } "
D E P E N D S $ { _ f i l e s _ d e p s }