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>
pull/36/head
Slávek Banko 5 years ago
parent 184d1c2a4d
commit 48b1e42b64
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -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 )

Loading…
Cancel
Save