Skip to content

Commit cfb49eb

Browse files
committed
Switch to USE_* style of enabling external library usage to match design pattern
1 parent fc7b38c commit cfb49eb

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ set( USE_HDF5 OFF CACHE BOOL "USE_HDF5" )
150150
set( USE_JASPER OFF CACHE BOOL "USE_JASPER" )
151151
set( USE_PIO OFF CACHE BOOL "USE_PIO" )
152152
set( USE_IPO OFF CACHE BOOL "USE_IPO" )
153+
set( USE_PNETCDF OFF CACHE BOOL "USE_PNETCDF" )
153154

154155
set( ENABLE_PNETCDF_QUILT OFF CACHE BOOL "ENABLE_PNETCDF_QUILT" )
155156
set( ENABLE_CHEM OFF CACHE BOOL "ENABLE_CHEM" )
@@ -274,8 +275,12 @@ if ( NOT ${WRFIO_NCD_NO_LARGE_FILE_SUPPORT} )
274275
endif()
275276

276277
# PnetCDF options require MPI
277-
if ( ${ENABLE_PNETCDF_QUILT} AND NOT ${USE_MPI} )
278-
message( STATUS "PnetCDF features require MPI usage" )
278+
if ( ${ENABLE_PNETCDF_QUILT} AND NOT ${USE_PNETCDF} )
279+
message( STATUS "PnetCDF Quilt IO requires PnetCDF" )
280+
set( USE_PNETCDF ON CACHE BOOL "Required by configuration" FORCE )
281+
endif()
282+
if ( ${USE_PNETCDF} AND NOT ${USE_MPI} )
283+
message( STATUS "PnetCDF require MPI usage" )
279284
set( USE_MPI ON CACHE BOOL "Required by configuration" FORCE )
280285
endif()
281286

@@ -483,8 +488,8 @@ endif()
483488

484489
# Find this first in case we need to use pnetcdf's netCDF
485490
# Priority is given to pnetcdf due to performance
486-
if ( ${USE_MPI} )
487-
find_package( PnetCDF QUIET )
491+
if ( ${USE_PNETCDF} )
492+
find_package( PnetCDF REQUIRED )
488493
endif()
489494

490495
# Included is a lightweight finder, but we really should switch to using UniData's netCDF cmake config

0 commit comments

Comments
 (0)