diff options
author | Timothy Pearson <[email protected]> | 2011-12-31 22:34:35 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-12-31 22:34:35 -0600 |
commit | 6092ca3fd1c345a94e4b634bc1a6370f735bcfd7 (patch) | |
tree | 0ebc558147c05c97492df4e93f02ae1244b95236 /modules | |
parent | 42b03b0965a9e958b6007b49201b7793d2bd4f65 (diff) | |
download | tde-cmake-6092ca3fd1c345a94e4b634bc1a6370f735bcfd7.tar.gz tde-cmake-6092ca3fd1c345a94e4b634bc1a6370f735bcfd7.zip |
Automatically generate ELF metadata for each TDE executable
This is another first for a Linux desktop environment!
Diffstat (limited to 'modules')
-rw-r--r-- | modules/TDEMacros.cmake | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index f13c98c..473fde1 100644 --- a/modules/TDEMacros.cmake +++ b/modules/TDEMacros.cmake @@ -3,6 +3,9 @@ # (C) 2010-2011 Serghei Amelian # serghei (DOT) amelian (AT) gmail.com # +# (C) 2011-2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# # Improvements and feedback are welcome # # This file is released under GPL >= 2 @@ -697,6 +700,15 @@ endmacro( tde_add_kpart ) ################################################# ##### +##### tde_curdatetime +macro( tde_curdatetime result ) + execute_process( COMMAND "date" "+%m/%d/%Y %H:%M:%S" OUTPUT_VARIABLE ${result} ) + string( REGEX REPLACE "(..)/(..)/(....) (........).*" "\\1/\\2/\\3 \\4" ${result} ${${result}} ) +endmacro( tde_curdatetime ) + + +################################################# +##### ##### tde_add_executable macro( tde_add_executable _arg_target ) @@ -711,6 +723,21 @@ macro( tde_add_executable _arg_target ) unset( _dependencies ) unset( _storage ) + # metadata + unset( _description ) + unset( _license ) + unset( _copyright ) + unset( _authors ) + unset( _product ) + unset( _organization ) + unset( _version ) + unset( _datetime ) + unset( _notes ) + + # default metadata + set( _product "Trinity Desktop Environment" ) + tde_curdatetime( _datetime ) + foreach( _arg ${ARGV} ) # this variable help us to skip @@ -760,6 +787,44 @@ macro( tde_add_executable _arg_target ) unset( ${_storage} ) endif( "${_arg}" STREQUAL "DESTINATION" ) + # metadata + if( "${_arg}" STREQUAL "DESCRIPTION" ) + set( _skip_store 1 ) + set( _storage "_description" ) + endif( ) + if( "${_arg}" STREQUAL "LICENSE" ) + set( _skip_store 1 ) + set( _storage "_license" ) + endif( ) + if( "${_arg}" STREQUAL "COPYRIGHT" ) + set( _skip_store 1 ) + set( _storage "_copyright" ) + endif( ) + if( "${_arg}" STREQUAL "AUTHORS" ) + set( _skip_store 1 ) + set( _storage "_authors" ) + endif( ) + if( "${_arg}" STREQUAL "PRODUCT" ) + set( _skip_store 1 ) + set( _storage "_product" ) + endif( ) + if( "${_arg}" STREQUAL "ORGANIZATION" ) + set( _skip_store 1 ) + set( _storage "_organization" ) + endif( ) + if( "${_arg}" STREQUAL "VERSION" ) + set( _skip_store 1 ) + set( _storage "_version" ) + endif( ) + if( "${_arg}" STREQUAL "DATETIME" ) + set( _skip_store 1 ) + set( _storage "_datetime" ) + endif( ) + if( "${_arg}" STREQUAL "NOTES" ) + set( _skip_store 1 ) + set( _storage "_notes" ) + endif( ) + # storing value if( _storage AND NOT _skip_store ) #set( ${_storage} "${${_storage}} ${_arg}" ) @@ -805,6 +870,18 @@ macro( tde_add_executable _arg_target ) endif( _setuid ) endif( _destination ) + # embed icon, name, and metadata + set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"${_notes}\"" ) + separate_arguments( ELF_EMBEDDING_METADATA ) + add_custom_command( + TARGET ${_target} + POST_BUILD + COMMAND ./tdelfeditor -m ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${ELF_EMBEDDING_METADATA} || true + COMMAND ./tdelfeditor -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true + COMMAND ./tdelfeditor -t ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${_target} || true + WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin + ) + endmacro( tde_add_executable ) |