vcpkg/ports/matio/CMakeLists.txt

61 lines
1.4 KiB
CMake
Raw Normal View History

2017-07-06 04:04:17 +08:00
cmake_minimum_required(VERSION 3.8.0)
project(libmatio C)
set(SRC
src/endian.c
src/inflate.c
src/io.c
src/mat.c
src/mat4.c
src/mat5.c
src/mat73.c
visual_studio/matio.def
src/matvar_cell.c
src/matvar_struct.c
src/read_data.c
src/snprintf.c
)
add_library(libmatio ${SRC})
target_include_directories(libmatio PRIVATE src visual_studio)
target_compile_definitions(libmatio PRIVATE
2017-07-06 04:04:17 +08:00
-DH5_NO_DEPRECATED_SYMBOLS
-DMAT73=1
-DREPLACE_GETOPT
2017-07-06 04:04:17 +08:00
-DMATIO_HAVE_INTTYPES_H=1
-DMATIO_HAVE_STDINT_H=1
)
find_package(ZLIB REQUIRED)
target_link_libraries(libmatio PRIVATE ZLIB::ZLIB)
target_compile_definitions(libmatio PRIVATE -DHAVE_ZLIB=1)
2017-07-06 04:04:17 +08:00
2018-03-13 16:52:00 +08:00
find_package(hdf5 CONFIG REQUIRED)
2019-03-15 05:33:28 +08:00
if(BUILD_SHARED_LIBS)
target_compile_definitions(libmatio PRIVATE -DHAVE_HDF5=1 -DH5_BUILT_AS_DYNAMIC_LIB)
2019-03-15 05:33:28 +08:00
if(HDF5_USE_STATIC_LIBRARIES)
target_link_libraries(libmatio PRIVATE hdf5::hdf5-static hdf5::hdf5_hl-static)
else()
target_link_libraries(libmatio PRIVATE hdf5::hdf5-shared hdf5::hdf5_hl-shared)
endif()
else()
target_compile_definitions(libmatio PRIVATE -DHAVE_HDF5=1 -DH5_BUILT_AS_STATIC_LIB)
2019-03-15 05:33:28 +08:00
target_link_libraries(libmatio PRIVATE hdf5::hdf5-static hdf5::hdf5_hl-static)
endif()
2017-07-06 04:04:17 +08:00
install(
TARGETS libmatio
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_HEADERS)
install(FILES
src/matio.h
visual_studio/matio_pubconf.h
DESTINATION include
)
endif()