try to use pkg-config to find libhdf5 and openmpi

This commit is contained in:
Janus Troelsen
2017-07-14 22:25:07 +02:00
committed by Yorik van Havre
parent f12c1e5df4
commit 04c52196c8

View File

@@ -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)