Skip to content

Commit

Permalink
only search for netcdf at top level
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Aug 19, 2020
1 parent f1a83f3 commit 57f939f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
19 changes: 11 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,17 @@ if (PIO_ENABLE_COVERAGE)
endif ()
endif ()

# Include this so we can check values in netcdf_meta.h.
INCLUDE(CheckCSourceCompiles)
INCLUDE(FindNetCDF)
if (PIO_ENABLE_FORTRAN)
find_package (NetCDF REQUIRED COMPONENTS C Fortran)
find_package (PnetCDF COMPONENTS C Fortran)
else()
find_package (NetCDF REQUIRED COMPONENTS C)
find_package (PnetCDF COMPONENTS C)
endif()

#==============================================================================
# INCLUDE SOURCE DIRECTORIES
#==============================================================================
Expand Down Expand Up @@ -265,11 +276,6 @@ if (PIO_ENABLE_DOC)
add_subdirectory (doc)
endif ()

# Include this so we can check values in netcdf_meta.h.
INCLUDE(CheckCSourceCompiles)
INCLUDE(FindNetCDF)
find_package (NetCDF REQUIRED)
find_package (PnetCDF)


SET(STATUS_PNETCDF PnetCDF_C_FOUND)
Expand Down Expand Up @@ -425,6 +431,3 @@ configure_file (
"${PROJECT_SOURCE_DIR}/cmake_config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)



3 changes: 2 additions & 1 deletion src/clib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ if (PIO_ENABLE_TIMING)
endif ()

#===== NetCDF-C =====
find_package (NetCDF "4.3.3" COMPONENTS C)

message("NetCDF_C_FOUND has value ${NetCDF_C_FOUND}")
if (NetCDF_C_FOUND)
target_include_directories (pioc
PUBLIC ${NetCDF_C_INCLUDE_DIRS})
Expand Down
2 changes: 1 addition & 1 deletion src/flib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ if (PIO_ENABLE_TIMING)
endif ()

#===== NetCDF-Fortran =====
find_package (NetCDF "4.3.3" COMPONENTS Fortran)
message("NetCDF_Fortran_FOUND is ${NetCDF_Fortran_FOUND}")
if (NetCDF_Fortran_FOUND)
target_include_directories (piof
PUBLIC ${NetCDF_Fortran_INCLUDE_DIRS})
Expand Down

0 comments on commit 57f939f

Please sign in to comment.