Skip to content

Commit

Permalink
now building ncint directory with cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Aug 19, 2020
1 parent cab47c3 commit eaa0656
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/clib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ include_directories(
target_include_directories (pioc
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

# Include the ncint source directory
target_include_directories (pioc
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ncint)

# System and compiler CPP directives
target_compile_definitions (pioc
PUBLIC ${CMAKE_SYSTEM_DIRECTIVE})
Expand Down
44 changes: 44 additions & 0 deletions src/ncint/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
cmake_minimum_required (VERSION 2.8.12)

add_library(ncint nc_get_vard.c ncintdispatch.c ncint_pio.c nc_put_vard.c)

# set up include-directories
include_directories(
"${CMAKE_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}" # to find foo/foo.h
"${PROJECT_BINARY_DIR}") # to find foo/config.h

# Include the clib source directory
target_include_directories (ncint
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

# Include the ncint source directory
target_include_directories (ncint
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../clib)

#===== NetCDF-C =====
find_package (NetCDF "4.3.3" COMPONENTS C)
if (NetCDF_C_FOUND)
target_include_directories (ncint
PUBLIC ${NetCDF_C_INCLUDE_DIRS})
target_compile_definitions (ncint
PUBLIC _NETCDF)
target_link_libraries (ncint
PUBLIC ${NetCDF_C_LIBRARIES})
if (${NetCDF_C_HAS_PARALLEL})
target_compile_definitions (ncint
PUBLIC _NETCDF4)
endif ()
if (${NetCDF_C_LOGGING_ENABLED})
target_compile_definitions (ncint
PUBLIC NETCDF_C_LOGGING_ENABLED)
# netcdf.h needs this to be defined to use netCDF logging.
target_compile_definitions (ncint
PUBLIC LOGGING)
endif()
else ()
target_compile_definitions (ncint
PUBLIC _NONETCDF)
endif ()



0 comments on commit eaa0656

Please sign in to comment.