build: Pick shared flatbuffers lib first

relates alisw/alidist#3165
This commit is contained in:
Dennis Klein 2021-07-15 15:23:14 +02:00
parent e3d3be888f
commit 8859c563ac

View File

@ -23,10 +23,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CommandsFormatDef.h.in ${CMAKE_CURREN
add_library(${target} Commands.cxx Commands.h ${CMAKE_CURRENT_BINARY_DIR}/CommandsFormat.h ${CMAKE_CURRENT_BINARY_DIR}/CommandsFormatDef.h) add_library(${target} Commands.cxx Commands.h ${CMAKE_CURRENT_BINARY_DIR}/CommandsFormat.h ${CMAKE_CURRENT_BINARY_DIR}/CommandsFormatDef.h)
add_library(FairMQ::${target} ALIAS ${target}) add_library(FairMQ::${target} ALIAS ${target})
# Some distros may not package the static library (e.g. Fedora), so we pick up the dynamic library instead
set(_flatbuffers flatbuffers::flatbuffers)
if(NOT TARGET flatbuffers::flatbuffers AND TARGET flatbuffers::flatbuffers_shared)
set(_flatbuffers flatbuffers::flatbuffers_shared) set(_flatbuffers flatbuffers::flatbuffers_shared)
if(NOT TARGET flatbuffers::flatbuffers_shared AND TARGET flatbuffers::flatbuffers)
set(_flatbuffers flatbuffers::flatbuffers)
endif() endif()
target_link_libraries(${target} target_link_libraries(${target}