summaryrefslogtreecommitdiffstats
path: root/modules/TDEMacros.cmake
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2019-01-11 03:00:07 +0100
committerSlávek Banko <slavek.banko@axis.cz>2019-01-12 18:38:11 +0100
commitb18d54755ea9d9babb90722c0ca2e1c8e08e7779 (patch)
tree01e47df1d5b50ae31f74fc40b3061142a4863508 /modules/TDEMacros.cmake
parent7d2860cb2e2fca41fa3a38c36992021d4f595672 (diff)
downloadtde-cmake-b18d54755ea9d9babb90722c0ca2e1c8e08e7779.tar.gz
tde-cmake-b18d54755ea9d9babb90722c0ca2e1c8e08e7779.zip
Add tde_create_tarball macro.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 6f9d42cd992ded747ffdc1cf407460e5136491fc)
Diffstat (limited to 'modules/TDEMacros.cmake')
-rw-r--r--modules/TDEMacros.cmake83
1 files changed, 83 insertions, 0 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 08640ea..0990b88 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1432,6 +1432,89 @@ endmacro( )
#################################################
#####
+##### tde_create_tarball
+#####
+##### Macro is used to create tarball.
+#####
+
+macro( tde_create_tarball )
+
+ unset( _target )
+ unset( _files )
+ unset( _destination )
+ set( _sourcedir "${CMAKE_CURRENT_SOURCE_DIR}" )
+ set( _var _target )
+
+ foreach( _arg ${ARGN} )
+
+ # found directive "TARGET"
+ if( "+${_arg}" STREQUAL "+TARGET" )
+ unset( _target )
+ set( _var _target )
+ set( _directive 1 )
+ endif( )
+
+ # found directive "SOURCEDIR"
+ if( "+${_arg}" STREQUAL "+SOURCEDIR" )
+ unset( _sourcedir )
+ set( _var _sourcedir )
+ set( _directive 1 )
+ endif( )
+
+ # found directive "FILES"
+ if( "+${_arg}" STREQUAL "+FILES" )
+ unset( _files )
+ set( _var _files )
+ set( _directive 1 )
+ endif( )
+
+ # found directive "DESTINATION"
+ if( "+${_arg}" STREQUAL "+DESTINATION" )
+ unset( _dest )
+ set( _var _dest )
+ set( _directive 1 )
+ endif( )
+
+ # collect data
+ if( _directive )
+ unset( _directive )
+ elseif( _var )
+ list( APPEND ${_var} ${_arg} )
+ endif( )
+
+ endforeach( )
+
+ if( NOT _target )
+ tde_message_fatal( "Target tarball name not specified." )
+ endif( )
+
+ if( NOT _files )
+ file( GLOB_RECURSE _files RELATIVE ${_sourcedir} "${_sourcedir}/*" )
+ 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}" )
+ add_custom_target( "${_target_name}-tarball" ALL
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_target}" )
+
+ add_custom_command(
+ COMMAND ${CMAKE_COMMAND} -E tar "cfz" "${CMAKE_CURRENT_BINARY_DIR}/${_target}" -- ${_files}
+ WORKING_DIRECTORY "${_sourcedir}"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_target}"
+ DEPENDS ${_files}
+ COMMENT "Create tarball ${_target_path}"
+ )
+
+ if( _destination )
+ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_target} DESTINATION ${_destination} )
+ endif( )
+
+endmacro()
+
+
+#################################################
+#####
##### tde_include_tqt
macro( tde_include_tqt )