build(examples): Deduplicate code into add_example helper

This commit is contained in:
Dennis Klein
2023-03-06 14:01:53 +01:00
committed by Dennis Klein
parent 8960ce9416
commit 3781495d29
13 changed files with 204 additions and 507 deletions

View File

@@ -1,19 +1,20 @@
################################################################################
# Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# Copyright (C) 2022-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
set(target fairmq-ex-custom-controller)
add_executable(${target} main.cxx)
target_link_libraries(${target} PRIVATE FairMQ)
set_target_properties(${target} PROPERTIES
ENABLE_EXPORTS ON
)
set(name "custom-controller")
set(exe "${exe_prefix}-${name}")
add_executable(${exe} main.cxx)
target_link_libraries(${exe} PRIVATE FairMQ)
set_target_properties(${exe} PROPERTIES ENABLE_EXPORTS ON)
set(test Example.custom-controller)
add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${target})
set(test "${testsuite}.${name}")
add_test(NAME ${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${exe})
set_tests_properties(${test} PROPERTIES TIMEOUT 30)
if(lsan_options)
set_tests_properties(${test} PROPERTIES ENVIRONMENT_MODIFICATION ${lsan_options})
endif()