From c38bd70b643a1bb619d4a285aab899153d180907 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Wed, 1 Mar 2017 14:24:35 +0100 Subject: [PATCH] Fixes to cosmotool to make it compile correctly on more recent cmake --- external/cosmotool/CMakeLists.txt | 6 ++++-- external/cosmotool/src/CMakeLists.txt | 4 +++- external/external_build.cmake | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/external/cosmotool/CMakeLists.txt b/external/cosmotool/CMakeLists.txt index 2cd377c..6c0ab9b 100644 --- a/external/cosmotool/CMakeLists.txt +++ b/external/cosmotool/CMakeLists.txt @@ -30,6 +30,8 @@ find_library(NETCDF_LIBRARY netcdf) find_library(NETCDFCPP_LIBRARY NAMES netcdf_c++ netcdf_c++4) find_library(GSL_LIBRARY gsl) find_library(GSLCBLAS_LIBRARY gslcblas) +find_library(ZLIB z) +find_library(LDLIB dl) if (ENABLE_SHARP) SET(SHARP_SOURCE ${CMAKE_SOURCE_DIR}/external/sharp) @@ -48,14 +50,14 @@ endif (ENABLE_SHARP) find_package(Boost 1.53) +message("INC DIRS: ${Boost_INCLUDE_DIRS}") mark_as_advanced(Boost_INCLUDE_DIRS Boost_LIBRARIES) -set(HDF5_FIND_COMPONENTS HL CXX) if(HDF5_ROOTDIR) SET(ENV{HDF5_ROOT} ${HDF5_ROOTDIR}) endif(HDF5_ROOTDIR) -include(FindHDF5) +find_package(HDF5 REQUIRED COMPONENTS HL CXX) include(FindPkgConfig) diff --git a/external/cosmotool/src/CMakeLists.txt b/external/cosmotool/src/CMakeLists.txt index e28a2d8..e80ff3b 100644 --- a/external/cosmotool/src/CMakeLists.txt +++ b/external/cosmotool/src/CMakeLists.txt @@ -58,10 +58,12 @@ SET(CosmoTool_SRCS ${CosmoTool_SRCS} include_directories(${Boost_INCLUDE_DIRS} ${GSL_INCLUDE_PATH} ${NETCDF_INCLUDE_PATH} ${NETCDFCPP_INCLUDE_PATH} ${CMAKE_BINARY_DIR}/src) set(CosmoTool_LIBS ${NETCDFCPP_LIBRARY} ${NETCDF_LIBRARY} ${GSL_LIBRARIES}) +message("HDF5: ${HDF5_LIBRARIES} ${HDF5_INCLUDE_DIRS}") if (HDF5_FOUND) - set(CosmoTool_LIBS ${CosmoTool_LIBS} ${HDF5_CXX_LIBRARIES} ${HDF5_LIBRARIES}) + set(CosmoTool_LIBS ${CosmoTool_LIBS} ${HDF5_CXX_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES}) include_directories(${HDF5_INCLUDE_DIRS}) endif (HDF5_FOUND) +set(CosmoTool_LIBS ${CosmoTool_LIBS} ${ZLIB} ${LDLIB}) set(CosmoTool_LIBS ${CosmoTool_LIBS} PARENT_SCOPE) diff --git a/external/external_build.cmake b/external/external_build.cmake index 88ce453..8159589 100644 --- a/external/external_build.cmake +++ b/external/external_build.cmake @@ -177,6 +177,7 @@ mark_as_advanced(NETCDF_LIBRARY NETCDFCPP_LIBRARY NETCDF_INCLUDE_PATH NETCDFCPP_ if (INTERNAL_BOOST) SET(BOOST_SOURCE_DIR ${BUILD_PREFIX}/boost-prefix/src/boost) + SET(cosmotool_DEPS ${cosmotool_DEPS} boost) ExternalProject_Add(boost URL ${BOOST_URL} PREFIX ${BUILD_PREFIX}/boost-prefix @@ -230,6 +231,8 @@ ExternalProject_Add(cosmotool PREFIX ${BUILD_PREFIX}/cosmotool-prefix SOURCE_DIR ${CMAKE_SOURCE_DIR}/external/cosmotool CMAKE_ARGS + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DHDF5_DIR=${HDF5_ROOTDIR} -DHDF5_ROOTDIR=${HDF5_ROOTDIR} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/ext_build/cosmotool @@ -241,7 +244,7 @@ ExternalProject_Add(cosmotool -DNETCDF_LIBRARY=${NETCDF_LIBRARY} -DNETCDFCPP_LIBRARY=${NETCDFCPP_LIBRARY} -DENABLE_SHARP=OFF - -DBOOST_INCLUDEDIR=${Boost_INCLUDE_DIRS} + -DBoost_INCLUDE_DIR=${Boost_INCLUDE_DIRS} ) SET(COSMOTOOL_LIBRARY ${CMAKE_BINARY_DIR}/ext_build/cosmotool/lib/libCosmoTool.a)