From 52ac327ff5e291511a743c09f1f5274b402e03c7 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 10 Aug 2020 12:09:50 -0600 Subject: [PATCH] adding support for NETCDF_INTEGRATION option to cmake, also fixing cmake build issue in read-only directories --- CMakeLists.txt | 14 +++++++++++--- cmake_config.h.in | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fdc0695f32..2ab712a5361 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,7 @@ option (PIO_ENABLE_LOGGING "Enable debug logging (large output possible)" OFF) option (PIO_ENABLE_DOC "Enable building PIO documentation" ON) option (PIO_ENABLE_COVERAGE "Enable code coverage" OFF) option (PIO_ENABLE_EXAMPLES "Enable PIO examples" ON) +option (PIO_ENABLE_NETCDF_INTEGRATION "Enable netCDF integration (netcdf-c-4.7.4 or later required)" ON) option (PIO_INTERNAL_DOC "Enable PIO developer documentation" OFF) option (PIO_TEST_BIG_ENDIAN "Enable test to see if machine is big endian" ON) option (PIO_USE_MPIIO "Enable support for MPI-IO auto detect" ON) @@ -106,6 +107,13 @@ else() set(ENABLE_LOGGING 0) endif() +# Set a variable that appears in the config.h.in file. +if(PIO_ENABLE_NETCDF_INTEGRATION) + set(NETCDF_INTEGRATION 1) +else() + set(NETCDF_INTEGRATION 0) +endif() + if(PIO_USE_MPISERIAL) set(USE_MPI_SERIAL 1) else() @@ -416,7 +424,7 @@ INSTALL(FILES "${PIO_BINARY_DIR}/libpio.settings" ##### configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/clib/pio_meta.h.in - ${CMAKE_CURRENT_SOURCE_DIR}/src/clib/pio_meta.h @ONLY) + ${CMAKE_CURRENT_BINARY_DIR}/src/clib/pio_meta.h @ONLY) -FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/clib/pio_meta.h - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src/clib/) +# FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/clib/pio_meta.h +# DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src/clib/) diff --git a/cmake_config.h.in b/cmake_config.h.in index eded4c71d97..5542a9d412a 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -34,4 +34,6 @@ #define HAVE_PAR_FILTERS @HAVE_PAR_FILTERS@ +#define NETCDF_INTEGRATION @NETCDF_INTEGRATION@ + #endif /* _PIO_CONFIG_ */