diff --git a/CMakeLists.txt b/CMakeLists.txt index c4888a4..1f4dace 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,17 +17,17 @@ option(ENABLE_SHARP "Enable SPHT support." ON) find_path(NETCDF_INCLUDE_PATH NAMES netcdf.h) find_path(NETCDFCPP_INCLUDE_PATH NAMES netcdfcpp.h netcdf) find_path(GSL_INCLUDE_PATH NAMES gsl/gsl_blas.h) +find_library(NETCDFCPP_LIBRARY NAMES netcdf_c++ netcdf_c++4) -IF(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf) +IF(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4") SET(FOUND_NETCDF4 1) FILE(WRITE ${CMAKE_BINARY_DIR}/src/ctool_netcdf_ver.hpp "#define NETCDFCPP4 1") -ELSE(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf) +ELSE(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4") SET(FOUND_NETCDF3 1) FILE(WRITE ${CMAKE_BINARY_DIR}/src/ctool_netcdf_ver.hpp "#undef NETCDFCPP4") -ENDIF(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf) +ENDIF(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4") 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)