Skip to content

Commit a4c9e44

Browse files
committed
Allow user-defined paths to NetCDF + OpenMP libs
1 parent a3afb93 commit a4c9e44

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ endif ()
5959

6060
# try to find netcdf support
6161

62-
find_library (NETCDF_LIBRARY NAMES netcdf)
62+
if (DEFINED NETCDF_USER_PATH)
63+
message (STATUS "Testing user NetCDF path")
64+
find_library (NETCDF_LIBRARY NAMES netcdf
65+
PATHS ${NETCDF_USER_PATH} NO_DEFAULT_PATH)
66+
else ()
67+
find_library (NETCDF_LIBRARY NAMES netcdf)
68+
endif ()
6369

6470
if (NETCDF_LIBRARY)
6571
message (STATUS "NetCDF library found")
@@ -70,7 +76,13 @@ endif ()
7076

7177
# try to find openmp support
7278

73-
find_package (OpenMP)
79+
if (DEFINED OPENMP_USER_PATH)
80+
message (STATUS "Testing user OpenMP path")
81+
find_package (OpenMP
82+
PATHS ${OPENMP_USER_PATH} NO_DEFAULT_PATH)
83+
else ()
84+
find_package (OpenMP)
85+
endif ()
7486

7587
if (OpenMP_CXX_FOUND AND (OpenMP_CXX_VERSION LESS 3))
7688
set (OpenMP_CXX_FOUND FALSE)

0 commit comments

Comments
 (0)