From bd6853d96d61d6c87110f06fad38117c60a7cef2 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Thu, 22 Oct 2015 13:20:33 +0200 Subject: [PATCH] Adjusted all paths for HDF5 --- CMakeLists.txt | 6 ------ external/external_build.cmake | 21 ++++++++------------- sample/CMakeLists.txt | 3 +-- src/CMakeLists.txt | 2 +- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b3c80e..1c9e42f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,12 +51,6 @@ ENDIF(YORICK_SUPPORT) find_program(CYTHON cython) find_library(ZLIB z) -if(HDF5_ROOTDIR) - SET(ENV{HDF5_ROOT} ${HDF5_ROOTDIR}) -endif(HDF5_ROOTDIR) -find_package(HDF5 COMPONENTS CXX HL) - - set(NETCDF_FIND_REQUIRED ${YORICK_SUPPORT}) set(GSL_FIND_REQUIRED TRUE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(NetCDF DEFAULT_MSG NETCDF_LIBRARY NETCDFCPP_LIBRARY NETCDF_INCLUDE_PATH) diff --git a/external/external_build.cmake b/external/external_build.cmake index 2fd6380..bc3fe95 100644 --- a/external/external_build.cmake +++ b/external/external_build.cmake @@ -67,24 +67,19 @@ if (INTERNAL_HDF5) ) SET(cosmotool_DEPS ${cosmotool_DEPS} hdf5) SET(hdf5_built hdf5) - set(HDF5_LIBRARY ${HDF5_BIN_DIR}/lib/libhdf5.a CACHE STRING "HDF5 lib" FORCE) - set(HDF5_CPP_LIBRARY ${HDF5_BIN_DIR}/lib/libhdf5_cpp.a CACHE STRING "HDF5 C++ lib" FORCE) - set(HDF5_HL_LIBRARY ${HDF5_BIN_DIR}/lib/libhdf5_hl.a CACHE STRING "HDF5-HL lib" FORCE) - set(HDF5_HL_CPP_LIBRARY ${HDF5_BIN_DIR}/lib/libhdf5_hl_cpp.a CACHE STRING "HDF5-HL C++ lib" FORCE) - SET(HDF5_INCLUDE_PATH ${HDF5_BIN_DIR}/include CACHE STRING "HDF5 include path" FORCE) SET(ENV{HDF5_ROOT} ${HDF5_BIN_DIR}) SET(HDF5_ROOTDIR ${HDF5_BIN_DIR}) SET(CONFIGURE_LDFLAGS "${CONFIGURE_LDFLAGS} -L${HDF5_BIN_DIR}/lib") SET(CONFIGURE_LIBS "${CONFIGURE_LIBS} -ldl") -else(INTERNAL_HDF5) - find_path(HDF5_INCLUDE_PATH hdf5.h) - find_library(HDF5_LIBRARY hdf5) - find_library(HDF5_CPP_LIBRARY hdf5_cpp) - find_library(HDF5_HL_CPP_LIBRARY hdf5_hl_cpp) - find_library(HDF5_HL_LIBRARY hdf5_hl) +else (INTERNAL_HDF5) + if(HDF5_ROOTDIR) + SET(ENV{HDF5_ROOT} ${HDF5_ROOTDIR}) + endif(HDF5_ROOTDIR) endif (INTERNAL_HDF5) -SET(CONFIGURE_CPP_FLAGS "${CONFIGURE_CPP_FLAGS} -I${HDF5_INCLUDE_PATH}") -mark_as_advanced(HDF5_INCLUDE_PATH HDF5_LIBRARY HDF5_CPP_LIBRARY HDF5_HL_LIBRARY HDF5_HL_CPP_LIBRARY) +find_package(HDF5 COMPONENTS C CXX HL) +mark_as_advanced(HDF5_INCLUDE_DIR HDF5_LIBRARY HDF5_HL_LIBRARY) + +SET(CONFIGURE_CPP_FLAGS "${CONFIGURE_CPP_FLAGS} -I${HDF5_INCLUDE_DIR}") ############### # Build NetCDF diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index 4b659be..fcab51a 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -35,8 +35,7 @@ add_executable(testPool testPool.cpp) target_link_libraries(testPool ${tolink}) if (HDF5_FOUND) - include_directories(${HDF5_INCLUDE_PATH}) - SET(tolink ${tolink} ${HDF5_CPP_LIBRARY} ${HDF5_LIBRARY} ${ZLIB}) + include_directories(${HDF5_INCLUDE_DIR}) add_executable(testReadFlash testReadFlash.cpp) target_link_libraries(testReadFlash ${tolink}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a6f241b..91878f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -76,7 +76,7 @@ if(YORICK_SUPPORT) include_directories(${NETCDF_INCLUDE_PATH} ${NETCDFCPP_INCLUDE_PATH}) endif(YORICK_SUPPORT) if (HDF5_FOUND) - set(CosmoTool_LIBS ${CosmoTool_LIBS} ${HDF5_CXX_LIBRARIES} ${HDF5_LIBRARIES}) + set(CosmoTool_LIBS ${CosmoTool_LIBS} ${HDF5_CXX_LIBRARY} ${HDF5_C_LIBRARY} ${ZLIB}) include_directories(${HDF5_INCLUDE_DIRS}) endif (HDF5_FOUND)