@@ -101,7 +101,7 @@ if(ENABLE_DEV_FTDI)
101101 # Pass LibUSB include directory and library location to LibFTDI
102102 get_build_interface_include_directory(TARGET usb-1.0 OUTPUT LIBUSB_INCLUDE_DIR)
103103 set (LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR} CACHE INTERNAL "" )
104- get_target_property (LIBUSB_LIBRARIES usb-1.0 IMPORTED_LOCATION )
104+ getTargetImportedLocation (LIBUSB_LIBRARIES usb-1.0)
105105 set (LIBUSB_LIBRARIES ${LIBUSB_LIBRARIES} CACHE INTERNAL "" )
106106
107107 find_package (Git REQUIRED)
@@ -273,7 +273,7 @@ if(ENABLE_FLATBUF_SERVER OR ENABLE_FLATBUF_CONNECT)
273273 )
274274 elseif (TARGET flatbuffers::flatc)
275275 add_executable (flatc IMPORTED GLOBAL )
276- get_target_property (FLATC_EXECUTABLE flatbuffers::flatc IMPORTED_LOCATION_RELEASE )
276+ getTargetImportedLocation (FLATC_EXECUTABLE flatbuffers::flatc)
277277 set_target_properties (flatc PROPERTIES IMPORTED_LOCATION ${FLATC_EXECUTABLE} )
278278 endif ()
279279 endif ()
@@ -332,19 +332,24 @@ if(ENABLE_FLATBUF_SERVER OR ENABLE_FLATBUF_CONNECT)
332332 endif ()
333333 endif ()
334334
335- if (TARGET flatbuffers::flatbuffers OR TARGET FlatBuffers::FlatBuffers)
335+ if (TARGET flatbuffers::flatbuffers OR TARGET flatbuffers::flatbuffers_shared OR TARGET FlatBuffers::FlatBuffers)
336336 if (NOT TARGET FlatBuffers)
337337 add_library (FlatBuffers INTERFACE IMPORTED GLOBAL )
338338 if (TARGET flatbuffers::flatbuffers)
339339 target_link_libraries (FlatBuffers INTERFACE flatbuffers::flatbuffers)
340340 get_build_interface_include_directory(TARGET flatbuffers::flatbuffers OUTPUT FLATBUFFERS_INCLUDE_DIR)
341+ elseif (TARGET flatbuffers::flatbuffers_shared)
342+ target_link_libraries (FlatBuffers INTERFACE flatbuffers::flatbuffers_shared)
343+ get_build_interface_include_directory(TARGET flatbuffers::flatbuffers_shared OUTPUT FLATBUFFERS_INCLUDE_DIR)
341344 else ()
342345 target_link_libraries (FlatBuffers INTERFACE FlatBuffers::FlatBuffers)
343346 get_build_interface_include_directory(TARGET FlatBuffers::FlatBuffers OUTPUT FLATBUFFERS_INCLUDE_DIR)
344347 endif ()
348+ else ()
349+ get_build_interface_include_directory(TARGET FlatBuffers OUTPUT FLATBUFFERS_INCLUDE_DIR)
345350 endif ()
346351
347- # static flatbuffers version detection from: https://github.com/hyperledger-archives/iroha-ametsuchi/blob/master/cmake/Modules/Findflatbuffers.cmake
352+ # flatbuffers version detection from: https://github.com/hyperledger-archives/iroha-ametsuchi/blob/master/cmake/Modules/Findflatbuffers.cmake
348353 if (FLATBUFFERS_INCLUDE_DIR AND EXISTS "${FLATBUFFERS_INCLUDE_DIR} /flatbuffers/base.h" )
349354 file (STRINGS "${FLATBUFFERS_INCLUDE_DIR} /flatbuffers/base.h" flatbuffers_version_str REGEX "#define FLATBUFFERS_VERSION_[A-Z]+ " )
350355 string (REGEX REPLACE ".*#define FLATBUFFERS_VERSION_MAJOR ([0-9]+).*" "\\ 1" flatbuffers_MAJOR_VERSION "${flatbuffers_version_str} " )
@@ -405,7 +410,7 @@ if(ENABLE_PROTOBUF_SERVER)
405410 )
406411 elseif (TARGET protobuf::protoc)
407412 add_executable (protoc IMPORTED GLOBAL )
408- get_target_property (PROTOC_EXECUTABLE protobuf::protoc IMPORTED_LOCATION_RELEASE )
413+ getTargetImportedLocation (PROTOC_EXECUTABLE protobuf::protoc)
409414 set_target_properties (protoc PROPERTIES IMPORTED_LOCATION ${PROTOC_EXECUTABLE} )
410415 endif ()
411416 endif ()
0 commit comments