diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 773acad1248..49f772ba371 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -6,10 +6,15 @@ project (PIOC C) # DEFINE THE TARGET #============================================================================== -add_library (pioc topology.c pio_file.c pioc_support.c pio_lists.c +set (src topology.c pio_file.c pioc_support.c pio_lists.c pioc.c pioc_sc.c pio_spmd.c pio_rearrange.c pio_nc4.c bget.c pio_nc.c pio_put_nc.c pio_get_nc.c pio_getput_int.c pio_msg.c pio_darray.c pio_darray_int.c pio_get_vard.c pio_put_vard.c pio_error.c) +if (NETCDF_INTEGRATION) + set (src ${src} ../ncint/nc_get_vard.c ../ncint/ncintdispatch.c ../ncint/ncint_pio.c ../ncint/nc_put_vard.c) +endif () + +add_library (pioc ${src}) # set up include-directories include_directories( @@ -42,10 +47,6 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") string(APPEND CMAKE_C_FLAGS " -std=c99 ") endif() -if (NETCDF_INTEGRATION) - target_link_libraries(pioc PUBLIC ncint) -endif () - #============================================================================== # DEFINE THE INSTALL #============================================================================== diff --git a/src/ncint/CMakeLists.txt b/src/ncint/CMakeLists.txt index 8d5776d46c8..2344f93bf84 100644 --- a/src/ncint/CMakeLists.txt +++ b/src/ncint/CMakeLists.txt @@ -1,45 +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 () +# 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}/../clib) + +# # Include the ncint source directory +# target_include_directories (ncint +# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +# #===== 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 () diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 115c732b51c..ebd9878d46b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -26,3 +26,7 @@ if (PIO_ENABLE_FORTRAN) message (STATUS "Cannot build performance test without gptl timing library") endif () endif() + +if (NETCDF_INTEGRATION) + add_subdirectory(ncint) +endif ()