@@ -51,6 +51,48 @@ set( USE_WRF ON CACHE BOOL "USE_WRF" )
51
51
## MPI & OpenMP
52
52
##
53
53
################################################################################
54
+
55
+ # First do externals
56
+ if ( ${BUILD_EXTERNALS} )
57
+ add_subdirectory ( external )
58
+ # If we got here everything built, we are safe to add find paths for libs
59
+ set ( ZLIB_ROOT ${INTERNAL_GRIB2_PATH} ) # This may get overridden by HDF5 if zlib is packaged with that
60
+ set ( PNG_ROOT ${INTERNAL_GRIB2_PATH} )
61
+ set ( Jasper_ROOT ${INTERNAL_GRIB2_PATH} )
62
+ endif ()
63
+
64
+
65
+ # Now find required libraries, which may have been affected by externals
66
+ if ( ${USE_WRF} )
67
+ # PATHS will be checked last
68
+ find_package (
69
+ WRF
70
+ COMPONENTS
71
+ WRF_Core io_netcdf io_grib1 io_int
72
+ # REQUIRED # this is technically required but we'll print our own msg
73
+ PATHS
74
+ ${PROJECT_SOURCE_DIR} /../WRF/install
75
+ ${PROJECT_SOURCE_DIR} /../wrf/install
76
+ QUIET
77
+ NO_CMAKE_ENVIRONMENT_PATH # Do not use _DIR option
78
+ )
79
+ if ( ${WRF_FOUND} )
80
+ message ( STATUS "Found WRF : ${WRF_CONFIG} (found version \" ${WRF_VERSION} \" )" )
81
+ else ()
82
+ message (
83
+ FATAL_ERROR
84
+ "Compiled WRF model not found. Please ensure a compiled WRF exists "
85
+ "and can be found by trying one of the following : \n "
86
+ "(1) provide -DWRF_ROOT=<path to install location> to CMake, if done "
87
+ "via the configure_new script use -- before option or see ./configure_new -h for more info\n "
88
+ "(2) set the environment variable WRF_ROOT to the path to the install location\n "
89
+ "(3) compile the WRF model code in ../WRF using the default install location\n "
90
+ "\n More detail on search modes of CMake can be found at\n "
91
+ "https://cmake.org/cmake/help/latest/command/find_package.html#search-modes"
92
+ )
93
+ endif ()
94
+ endif ()
95
+
54
96
if ( ${USE_MPI} )
55
97
# Through ***MUCH*** debugging, if utilizing MPI_<LANG>_COMPILER
56
98
# https://cmake.org/cmake/help/latest/module/FindMPI.html#variables-for-locating-mpi
@@ -83,40 +125,6 @@ if ( ${USE_OPENMP} )
83
125
endif ()
84
126
85
127
86
- # First do externals
87
- if ( ${BUILD_EXTERNALS} )
88
- add_subdirectory ( external )
89
- # If we got here everything built, we are safe to add find paths for libs
90
- set ( ZLIB_ROOT ${INTERNAL_GRIB2_PATH} ) # This may get overridden by HDF5 if zlib is packaged with that
91
- set ( PNG_ROOT ${INTERNAL_GRIB2_PATH} )
92
- set ( Jasper_ROOT ${INTERNAL_GRIB2_PATH} )
93
- endif ()
94
-
95
-
96
- # Now find required libraries, which may have been affected by externals
97
- if (
98
- DEFINED WRF_DIR OR
99
- DEFINED WRF_ROOT OR
100
- DEFINED ENV{WRF_DIR} OR
101
- DEFINED ENV{WRF_ROOT} OR
102
- EXISTS "${PROJECT_SOURCE_DIR} /../WRF/" OR EXISTS "${PROJECT_SOURCE_DIR} /../wrf/" )
103
- # PATHS will be checked last
104
- find_package (
105
- WRF
106
- COMPONENTS
107
- WRF_Core io_netcdf io_grib1 io_int
108
- REQUIRED
109
- PATHS
110
- ${PROJECT_SOURCE_DIR} /../WRF/install
111
- ${PROJECT_SOURCE_DIR} /../wrf/install
112
- )
113
- if ( ${WRF_FOUND} )
114
- message ( STATUS "Found WRF : ${WRF_CONFIG} (found version \" ${WRF_VERSION} \" )" )
115
- endif ()
116
- elseif ( ${USE_WRF} )
117
- message ( STATUS "No WRF_DIR or WRF_ROOT provided, skipping targets that rely on WRF" )
118
- endif ()
119
-
120
128
# Find externals now -- this is a little different than normal since we want WRF to
121
129
# take precedence if it is present on which libraries to use to avoid library splicing
122
130
# rather than finding our external thirdparty libraries first
0 commit comments