diff --git a/CMakeLists.txt b/CMakeLists.txt index d44f938c87..96d2ebeb00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -661,7 +661,33 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if (WIN32) find_package(HDF5 COMPONENTS NO_MODULE REQUIRED static) else() - find_package(HDF5 REQUIRED) + find_package(PkgConfig) + pkg_search_module(HDF5 REQUIRED hdf5-serial) + if(NOT HDF5_FOUND) + find_package(HDF5 REQUIRED) + else() + add_compile_options(${HDF5_CFLAGS}) + link_directories(${HDF5_LIBRARY_DIRS}) + link_libraries(${HDF5_LIBRARIES}) + find_file(Hdf5dotH hdf5.h PATHS ${HDF5_INCLUDE_DIRS} NO_DEFAULT_PATH) + if(NOT Hdf5dotH) + message( FATAL_ERROR "hdf5-serial not found in an error message above.") + endif() + endif() + check_include_file_cxx(hdf5.h HDF5_FOUND) + if(NOT HDF5_FOUND) + message( FATAL_ERROR "hdf5.h was not found.") + endif() + + # Med Fichier can require MPI + pkg_search_module(OPENMPI REQUIRED ompi-cxx) + add_compile_options(${OPENMPI_CFLAGS}) + link_directories(${OPENMPI_LIBRARY_DIRS}) + link_libraries(${OPENMPI_LIBRARIES}) + find_file(MpidotH mpi.h PATHS ${OPENMPI_INCLUDE_DIRS} NO_DEFAULT_PATH) + if(NOT MpidotH) + message( FATAL_ERROR "mpi.h was not found. Check for error above.") + endif() endif() find_package(MEDFile REQUIRED) set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc)