From 71204172df778b5789c6929d962cb09829e00a40 Mon Sep 17 00:00:00 2001 From: Xiaoqiang Wang Date: Thu, 27 Jul 2017 12:51:10 +0200 Subject: [PATCH] simplify hdf5 linking --- slsReceiverSoftware/CMakeLists.txt | 59 +++++++++++------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/slsReceiverSoftware/CMakeLists.txt b/slsReceiverSoftware/CMakeLists.txt index f79785201..5113aceae 100644 --- a/slsReceiverSoftware/CMakeLists.txt +++ b/slsReceiverSoftware/CMakeLists.txt @@ -9,56 +9,36 @@ set(SOURCES src/utilities.cpp src/File.cpp src/BinaryFile.cpp - src/ThreadObject.cpp - src/Listener.cpp + src/ThreadObject.cpp + src/Listener.cpp src/DataProcessor.cpp src/DataStreamer.cpp src/Fifo.cpp ) +# REST if (REST) - MESSAGE("\n *** Using REST Implementation *** \n") - list (APPEND SOURCES src/UDPRestImplementation.cpp) -# add_library(poco etc.) + MESSAGE("\n *** Using REST Implementation *** \n") + list (APPEND SOURCES src/UDPRestImplementation.cpp) + # add_library(poco etc.) else (REST) - MESSAGE("\n *** Using Standard Implementation *** \n") + MESSAGE("\n *** Using Standard Implementation *** \n") endif (REST) - # HDF5 if (HDF5_FOUND) - set (HDF5DIR /opt/hdf5v1.10.0) - - include_directories( - ${HDF5DIR}/include - ) - add_definitions( - -DHDF5C - ) - add_library(hdf5 SHARED IMPORTED) - add_library(hdf5_cpp SHARED IMPORTED) - add_library(sz SHARED IMPORTED) - add_library(z SHARED IMPORTED) - set_target_properties(hdf5 PROPERTIES - IMPORTED_LOCATION ${HDF5DIR}/lib/libhdf5.so - ) - set_target_properties(hdf5_cpp PROPERTIES - IMPORTED_LOCATION ${HDF5DIR}/lib/libhdf5_cpp.so - ) - set_target_properties(sz PROPERTIES - IMPORTED_LOCATION ${HDF5DIR}/lib/libsz.so - ) - set_target_properties(z PROPERTIES - IMPORTED_LOCATION ${HDF5DIR}/lib/libz.so - ) - set(_hdf5_libs hdf5 hdf5_cpp sz z) - - list (APPEND SOURCES - src/HDF5File.cpp - src/HDF5FileStatic.cpp - ) + include_directories( + ${HDF5_INCLUDE_DIRS} + ) + add_definitions( + -DHDF5C ${HDF5_DEFINITIONS} + ) + list (APPEND SOURCES + src/HDF5File.cpp + src/HDF5FileStatic.cpp + ) endif () @@ -105,5 +85,8 @@ target_link_libraries(slsReceiver pthread zmq rt - ${_hdf5_libs} ) + +if (HDF5_FOUND) + target_link_libraries(slsReceiver ${HDF5_CXX_LIBRARIES}) +endif ()