summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-04-02 19:33:33 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-04-04 15:21:08 +0200
commit48b1e42b64d8c5c47461db1bf0ca3db9ce3fe726 (patch)
tree2fff97326a24871f990989860194babb0bd23375
parent184d1c2a4d3003cf0d6d4500f0338962ceb0cf35 (diff)
downloadcmake-48b1e42b64d8c5c47461db1bf0ca3db9ce3fe726.tar.gz
cmake-48b1e42b64d8c5c47461db1bf0ca3db9ce3fe726.zip
Store ELF metadata as a separate target instead of the POST_BUILD command.
This allows naturally storing ELF metadata also in tdelibs. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--modules/TDEMacros.cmake33
1 files changed, 23 insertions, 10 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 8bb1d2b..23de3ee 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -956,19 +956,29 @@ macro( tde_add_library _arg_target )
separate_arguments( ELF_EMBEDDING_METADATA )
if( TDELFEDITOR_EXECUTABLE AND _soname )
if( _version )
- add_custom_command(
- TARGET ${_target}
- POST_BUILD
- COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${CMAKE_CURRENT_BINARY_DIR}/${_soname}.${_version} ${ELF_EMBEDDING_METADATA} || true
- COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${CMAKE_CURRENT_BINARY_DIR}/${_soname}.${_version} || true
+ get_filename_component( _target_lib ${CMAKE_CURRENT_BINARY_DIR}/${_soname}.${_version} ABSOLUTE )
+ else( )
+ get_filename_component( _target_lib ${CMAKE_CURRENT_BINARY_DIR}/${_soname} ABSOLUTE )
+ endif( )
+ file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_lib}" )
+
+ if( NOT _exclude_from_all )
+ add_custom_target(
+ ${_target}+metadata ALL
+ COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${_target_lib} ${ELF_EMBEDDING_METADATA} || true
+ COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${_target_lib} || true
+ COMMENT "Storing SCM metadata in ${_target_path}"
+ DEPENDS ${_target} ${TDELFEDITOR_EXECUTABLE}
)
else( )
add_custom_command(
TARGET ${_target}
POST_BUILD
- COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${CMAKE_CURRENT_BINARY_DIR}/${_soname} ${ELF_EMBEDDING_METADATA} || true
- COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${CMAKE_CURRENT_BINARY_DIR}/${_soname} || true
+ COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${_target_lib} ${ELF_EMBEDDING_METADATA} || true
+ COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${_target_lib} || true
+ COMMENT "Storing SCM metadata in ${_target_path}"
)
+ add_dependencies( ${_target} ${TDELFEDITOR_EXECUTABLE} )
endif( )
endif( TDELFEDITOR_EXECUTABLE AND _soname )
@@ -1177,12 +1187,15 @@ macro( tde_add_executable _arg_target )
set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"${_target}\" \"${TDE_SCM_MODULE_NAME}\" \"${TDE_SCM_MODULE_REVISION}\" \"${_notes}\"" )
separate_arguments( ELF_EMBEDDING_METADATA )
if( TDELFEDITOR_EXECUTABLE )
- add_custom_command(
- TARGET ${_target}
- POST_BUILD
+ get_filename_component( _target_path ${CMAKE_CURRENT_BINARY_DIR}/${_target} ABSOLUTE )
+ file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_path}" )
+ add_custom_target(
+ ${_target}+metadata ALL
COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${ELF_EMBEDDING_METADATA} || true
COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true
COMMAND ${TDELFEDITOR_EXECUTABLE} -t ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${_target} || true
+ COMMENT "Storing SCM metadata in ${_target_path}"
+ DEPENDS ${_target} ${TDELFEDITOR_EXECUTABLE}
)
endif( TDELFEDITOR_EXECUTABLE )