Skip to content
Snippets Groups Projects
Commit 044a691f authored by Oliver Heidmann's avatar Oliver Heidmann Committed by Uwe Schulzweida
Browse files

cmake now working on levante

parent a1ee4950
No related branches found
No related tags found
2 merge requests!105Develop,!104M300433/netcdf memory read write
......@@ -4,26 +4,39 @@
cmake_minimum_required( VERSION 3.12 FATAL_ERROR )
project( cdi VERSION 2.4.0 LANGUAGES C )
project(libcdi VERSION 2.4.0 LANGUAGES C )
set(CMAKE_C_STANDARD 11)
include(CheckIncludeFile)
configure_file (
"${PROJECT_SOURCE_DIR}/cmake/cdi_config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
"${PROJECT_SOURCE_DIR}/src/config.h"
)
include_directories("${PROJECT_BINARY_DIR}")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(NetCDF)
find_package(hdf5 REQUIRED)
if(hdf5_FOUND)
message(STATUS "HDF5 shaed found")
else()
message(FATAL_ERROR "HDF shared not found")
endif()
#NetCDF
find_package(netCDF COMPONENTS C REQUIRED)
set(netcdf_flag HAVE_LIBNETCDF)
set(netcdf_flag ${HAVE_LIBNETCDF})
check_include_files("netcdf.h" ${netcdf_flag} C)
if (${netCDF_FOUND})
message(STATUS "added compile definition HAVE_LIBNETCDF=${netCDF_FOUND}")
add_compile_definitions(HAVE_LIBNETCDF=${netCDF_FOUND})
else()
message(WARNING "netcdf not found, compiling without netcdf")
endif ()
set(HAVE_NETCDF ${netCDF_FOUND} )
if (netCDF_FOUND)
set(HAVE_NETCDF 1)
endif ()
#adding subdirectories
## lib and general files
add_subdirectory(src)
## cdi executable
add_subdirectory(app)
add_subdirectory( src )
add_subdirectory( app )
#target_link_libraries(cdi PRIVATE NetCDF)
......@@ -7,6 +7,6 @@ target_include_directories(cdi PUBLIC
$<INSTALL_INTERFACE:include
)
target_link_libraries(cdi PUBLIC cdilib)
target_link_libraries(cdi PUBLIC cdilib netCDF::netcdf ${HDF5_LIBS} pthread)
target_compile_definitions(cdi PUBLIC HAVE_CONFIG_H)
......@@ -142,5 +142,7 @@ add_library(cdilib
${cdi_src_files}
# INSTALL_HEADERS_LIST cdi.h
)
find_package(HDF5 REQUIRED COMPONENTS C REQUIRED)
target_link_libraries(cdilib PUBLIC netCDF::netcdf ${HDF5_LIBS})
target_compile_definitions(cdilib PUBLIC HAVE_CONFIG_H)
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