summaryrefslogtreecommitdiffstats
path: root/modules/TDEMacros.cmake
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-05-10 15:50:14 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-05-11 00:47:39 +0200
commit083913c406d3aa3fc28bce2897f0231eb4e678dc (patch)
tree89092569ac8ffcad95e7eecd373cf92234c16947 /modules/TDEMacros.cmake
parente2a19928ed3dfacd37a71f6848e68b6315a15cd9 (diff)
downloadtde-cmake-083913c406d3aa3fc28bce2897f0231eb4e678dc.tar.gz
tde-cmake-083913c406d3aa3fc28bce2897f0231eb4e678dc.zip
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> (cherry picked from commit e72aabadf5ddef845a432542176e969fad8a7ef3)
Diffstat (limited to 'modules/TDEMacros.cmake')
-rw-r--r--modules/TDEMacros.cmake22
1 files changed, 20 insertions, 2 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 88ad8bc..2770fa2 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1114,13 +1114,22 @@ macro( tde_add_library _arg_target )
file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_lib}" )
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(
${_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}
+ DEPENDS tdelfeditor-write
)
+ add_dependencies( tdelfeditor-write ${_target} )
else( )
add_custom_command(
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}\"" )
separate_arguments( ELF_EMBEDDING_METADATA )
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 )
file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_path}" )
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} -t ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${_target} || true
COMMENT "Storing SCM metadata in ${_target_path}"
- DEPENDS ${_target} ${TDELFEDITOR_EXECUTABLE}
+ DEPENDS tdelfeditor-write
)
+ add_dependencies( tdelfeditor-write ${_target} )
endif( TDELFEDITOR_EXECUTABLE )
endmacro( tde_add_executable )