##################
# Build CosmoTool
##################


ExternalProject_Add(cosmotool
  DEPENDS ${cosmotool_DEPS}
  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
	-DNETCDF_INCLUDE_PATH=${NETCDF_INCLUDE_PATH}
	-DNETCDFCPP_INCLUDE_PATH=${NETCDFCPP_INCLUDE_PATH}
	-DGSL_INCLUDE_PATH=${GSL_INCLUDE_PATH} 
	-DGSL_LIBRARY=${GSL_LIBRARY} 
	-DGSLCBLAS_LIBRARY=${GSLCBLAS_LIBRARY}
	-DNETCDF_LIBRARY=${NETCDF_LIBRARY}
	-DNETCDFCPP_LIBRARY=${NETCDFCPP_LIBRARY}
  -DENABLE_SHARP=OFF
  -DBUILD_PYTHON=OFF
  -DBoost_INCLUDE_DIR=${Boost_INCLUDE_DIRS}
  ${CYTHON_OPTION}

)
SET(COSMOTOOL_LIBRARY ${CMAKE_BINARY_DIR}/ext_build/cosmotool/lib/libCosmoTool.a)
set(COSMOTOOL_INCLUDE_PATH ${CMAKE_BINARY_DIR}/ext_build/cosmotool/include)

include_directories(${COSMOTOOL_INCLUDE_PATH} )
