Commit ec70a5e0 authored by Lars Bilke's avatar Lars Bilke

[CMake] Hack: use custom FindHDF5.cmake on MSVC Conan.

parent 5de4e3d5
......@@ -104,7 +104,13 @@ target_include_directories(${XDMF_LIBNAME} PUBLIC
if(OGS_USE_CONAN AND UNIX AND APPLE)
find_package(Iconv REQUIRED)
endif()
target_link_libraries(${XDMF_LIBNAME} Boost::boost ${Iconv_LIBRARIES} ZLIB::ZLIB)
if(MSVC AND OGS_USE_CONAN)
# Hack: Conan HDF5 not found on Windows
target_link_libraries(${XDMF_LIBNAME} ${CONAN_LIBS})
else()
target_link_libraries(${XDMF_LIBNAME} Boost::boost ${Iconv_LIBRARIES} ZLIB::ZLIB)
endif()
target_include_directories(${XDMF_LIBNAME}Core PUBLIC
${PROJECT_SOURCE_DIR}/ThirdParty/xdmf/core
${PROJECT_BINARY_DIR}/ThirdParty/xdmf/core
......
......@@ -194,3 +194,9 @@ endif()
if(OGS_USE_PETSC)
set(PETSC_DIR ${CONAN_PETSC_ROOT} CACHE INTERNAL "")
endif()
if(MSVC AND OGS_USE_CONAN)
# Hack: Conan HDF5 not found on Windows
# Use custom FindHDF5 with forced values from Conan
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/scripts/cmake/conan/win-hdf5")
endif()
if(HDF5_FOUND)
return()
endif()
set(HDF5_FOUND TRUE CACHE INTERNAL "")
set(HDF5_VERSION "${ogs.tested_version.hdf5}" CACHE INTERNAL "")
set(HDF5_DEFINITIONS "" CACHE INTERNAL "")
set(HDF5_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_HDF5} CACHE INTERNAL "")
foreach(LIB ${CONAN_LIBS_HDF5})
find_library(HDF5_LIB NAMES ${LIB} PATHS ${CONAN_LIB_DIRS_HDF5})
list(APPEND HDF5_LIBRARIES ${HDF5_LIB})
endforeach()
set(HDF5_LIBRARIES ${HDF5_LIBRARIES} CACHE INTERNAL "")
message(STATUS "Found HDF5 ${ogs.tested_version.hdf5} via Conan: ${CONAN_HDF5_ROOT}")
Markdown is supported
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