Skip to content
Snippets Groups Projects
Commit 8bd1681a authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

added options to en-/disable libraries in cmake

parent 07f0fb07
No related branches found
No related tags found
No related merge requests found
Pipeline #97215 canceled
This commit is part of merge request !121. Comments created here will be created in the context of that merge request.
...@@ -10,11 +10,14 @@ include(CheckIncludeFile) ...@@ -10,11 +10,14 @@ include(CheckIncludeFile)
# Finding libraries # Finding libraries
### -------------- Pthread --------------------------- ### -------------- Pthread ---------------------------
message("Start check for pthread")
include(FindThreads) option(enable_pthread "Use the pthread library [default=ON]" ON)
find_package(Threads REQUIRED) if(${enable_pthread})
set_target_properties(Threads::Threads PROPERTIES THREADS_PREFER_PTHREAD_FLAG TRUE) include(FindThreads)
list(APPEND cdi_compile_defs HAVE_PTHREAD=1) find_package(Threads REQUIRED)
set_target_properties(Threads::Threads PROPERTIES THREADS_PREFER_PTHREAD_FLAG TRUE)
list(APPEND cdi_compile_defs HAVE_PTHREAD=1)
endif()
# enable default internal libs # enable default internal libs
option(enable_libgrib "GRIB support [default=ON]" ON) option(enable_libgrib "GRIB support [default=ON]" ON)
...@@ -42,29 +45,35 @@ if(${enable_service}) ...@@ -42,29 +45,35 @@ if(${enable_service})
list(APPEND cdi_compile_defs HAVE_LIBSERVICE=1) list(APPEND cdi_compile_defs HAVE_LIBSERVICE=1)
endif() endif()
# ecCodes # ecCodes
find_package(eccodes) option(enable_eccodes "Use the eccodes library [default=ON]" ON)
if (${eccodes_FOUND}) if(${enable_eccodes} OR eccodes_ROOT)
list(APPEND cdi_compile_defs HAVE_LIBGRIB_API=${eccodes_FOUND}) find_package(eccodes)
message(VERBOSE "added compile definition HAVE_LIBGRIB_API=${eccodes_FOUND}") if (${eccodes_FOUND})
else() list(APPEND cdi_compile_defs HAVE_LIBGRIB_API=${eccodes_FOUND})
message(WARNING "eccodes not found, compiling without eccodes") message(VERBOSE "added compile definition HAVE_LIBGRIB_API=${eccodes_FOUND}")
endif () else()
message(WARNING "eccodes not found, compiling without eccodes")
endif ()
endif()
# NetCDF # NetCDF
find_package(netCDF COMPONENTS C REQUIRED) option(enable_netcdf "Use the netcdf library [default=ON]" ON)
if (TARGET netCDF::netcdf) if(${enable_netcdf} OR netCDF_ROOT )
list(APPEND cdi_compile_defs find_package(netCDF COMPONENTS C REQUIRED)
HAVE_LIBNETCDF=${netCDF_FOUND} if (TARGET netCDF::netcdf)
HAVE_LIBNC_DAP=${netCDF_FOUND} list(APPEND cdi_compile_defs
HAVE_NETCDF4=${netCDF_FOUND} HAVE_LIBNETCDF=${netCDF_FOUND}
HAVE_LIBGRIB_API=${netCDF_FOUND} HAVE_LIBNC_DAP=${netCDF_FOUND}
HAVE_LIBGRIB=${netCDF_FOUND} HAVE_NETCDF4=${netCDF_FOUND}
) HAVE_LIBGRIB_API=${netCDF_FOUND}
message(VERBOSE "added to list of definitions: ${cdi_compile_defs} ") HAVE_LIBGRIB=${netCDF_FOUND}
else() )
message(WARNING "netcdf not found, compiling without netcdf") else()
endif () message(WARNING "netcdf target not found, compiling without netcdf")
endif ()
endif()
message(VERBOSE "looking for config.h in: ${PROJECT_BINARY_DIR}/src") message(VERBOSE "looking for config.h in: ${PROJECT_BINARY_DIR}/src")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment