Write metadata to libraries and binaries as a last step.

This prevents concurrency of writing metadata and linking
with other libraries, which could cause FTBFS.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/43/head
Slávek Banko 5 years ago
parent 778522d104
commit e72aabadf5
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -1114,13 +1114,22 @@ macro( tde_add_library _arg_target )
file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_lib}" ) file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_lib}" )
if( NOT _exclude_from_all ) if( NOT _exclude_from_all )
# create target for all metadata writes
if( NOT TARGET tdelfeditor-write )
add_custom_target( tdelfeditor-write
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
DEPENDS ${TDELFEDITOR_EXECUTABLE}
COMMENT "Write metadata to binaries..."
)
endif( )
add_custom_target( add_custom_target(
${_target}+metadata ALL ${_target}+metadata ALL
COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${_target_lib} ${ELF_EMBEDDING_METADATA} || true COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${_target_lib} ${ELF_EMBEDDING_METADATA} || true
COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${_target_lib} || true COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${_target_lib} || true
COMMENT "Storing SCM metadata in ${_target_path}" COMMENT "Storing SCM metadata in ${_target_path}"
DEPENDS ${_target} ${TDELFEDITOR_EXECUTABLE} DEPENDS tdelfeditor-write
) )
add_dependencies( tdelfeditor-write ${_target} )
else( ) else( )
add_custom_command( add_custom_command(
TARGET ${_target} TARGET ${_target}
@ -1338,6 +1347,14 @@ 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}\"" ) 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 ) separate_arguments( ELF_EMBEDDING_METADATA )
if( TDELFEDITOR_EXECUTABLE ) if( TDELFEDITOR_EXECUTABLE )
# create target for all metadata writes
if( NOT TARGET tdelfeditor-write )
add_custom_target( tdelfeditor-write
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
DEPENDS ${TDELFEDITOR_EXECUTABLE}
COMMENT "Write metadata to binaries..."
)
endif( )
get_filename_component( _target_path ${CMAKE_CURRENT_BINARY_DIR}/${_target} ABSOLUTE ) get_filename_component( _target_path ${CMAKE_CURRENT_BINARY_DIR}/${_target} ABSOLUTE )
file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_path}" ) file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_path}" )
add_custom_target( add_custom_target(
@ -1346,8 +1363,9 @@ macro( tde_add_executable _arg_target )
COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true
COMMAND ${TDELFEDITOR_EXECUTABLE} -t ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${_target} || true COMMAND ${TDELFEDITOR_EXECUTABLE} -t ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${_target} || true
COMMENT "Storing SCM metadata in ${_target_path}" COMMENT "Storing SCM metadata in ${_target_path}"
DEPENDS ${_target} ${TDELFEDITOR_EXECUTABLE} DEPENDS tdelfeditor-write
) )
add_dependencies( tdelfeditor-write ${_target} )
endif( TDELFEDITOR_EXECUTABLE ) endif( TDELFEDITOR_EXECUTABLE )
endmacro( tde_add_executable ) endmacro( tde_add_executable )

Loading…
Cancel
Save