Commit e6504420 authored by Florian Goth's avatar Florian Goth
Browse files

include HDF5 part

parent 4d0a19c9
Pipeline #13907 failed with stages
in 13 minutes and 2 seconds
add_library(libmy mylib.cpp)
set_target_properties(libmy PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED YES)
target_include_directories(libmy PUBLIC ${CMAKE_SOURCE_DIR}/include)
\ No newline at end of file
target_include_directories(libmy PUBLIC ${CMAKE_SOURCE_DIR}/include)
find_package(HDF5 COMPONENTS CXX)
set(MYHDF5INCLUDES ${HDF5_INCLUDE_DIRS})
set(MYHDF5LIBS ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
if( (NOT HDF5_FOUND) )
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0")
message(STATUS "Fetching libhdf-1.12.1")
set(libhdf5major "1.12")
set(libhdf5minor "1")
set(libhdf5ver "${libhdf5major}.${libhdf5minor}")
include(FetchContent)
FetchContent_Declare(libhdf5
URL https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${libhdf5major}/hdf5-${libhdf5ver}/src/hdf5-${libhdf5ver}.tar.gz
# GIT_REPOSITORY https://github.com/HDFGroup/hdf5.git
# GIT_TAG hdf5-1_12_1
)
FetchContent_GetProperties(libhdf5)
if(NOT libhdf5_POPULATED)
FetchContent_Populate(libhdf5)
# Make subproject to use 'BUILD_SHARED_LIBS=ON' setting.
set(HDF5_EXTERNALLY_CONFIGURED 1)
set(HDF5_EXPORTED_TARGETS "hdf5_cpp-static")
set(HDF5_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support")
set(HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library")
set(HDF5_BUILD_HL_LIB OFF CACHE BOOL "Build HIGH Level HDF5 Library")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries")
set(HDF5_BUILD_TOOLS OFF CACHE BOOL "Build HDF5 Tools")
set(HDF5_BUILD_EXAMPLES OFF CACHE BOOL "Build HDF5 Library Examples")
set(BUILD_TESTING OFF CACHE BOOL "Build HDF5 Unit Testing")
set(HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)")
message(STATUS "libhdf5 source dir: ${libhdf5_SOURCE_DIR}")
message(STATUS "libhdf5 binary dir: ${libhdf5_BINARY_DIR}")
add_subdirectory(${libhdf5_SOURCE_DIR} ${libhdf5_BINARY_DIR})
set(HDF5_DIR ${libhdf5_BINARY_DIR} CACHE PATH "libhdf5 path" FORCE)
endif()
set(MYHDF5INCLUDES ${HDF5_INCLUDE_DIR} ${libhdf5_BINARY_DIR})
set(MYHDF5LIBS hdf5_cpp-static)
else()
message(FATAL_ERROR "HDF5 not found and environment(cmake < 3.12) unsuited for automatic retrieval!")
endif()
endif()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment