Skip to content

Commit 49b0fba

Browse files
committed
Add imported targets netcdf::netcdff and netcdf::netcdff to work with WRF
1 parent e571906 commit 49b0fba

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/cmake-modules/FindNetCDF.cmake

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,26 @@ set (NETCDF_LIBRARIES ${NetCDF_libs} CACHE INTERNAL "All NetCDF libraries requir
8888
include (FindPackageHandleStandardArgs)
8989
find_package_handle_standard_args (NetCDF DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDES NetCDF_has_interfaces)
9090

91+
if (NETCDF_FOUND AND NOT TARGET netCDF::netcdf)
92+
add_library(netCDF::netcdf UNKNOWN IMPORTED)
93+
set_target_properties(
94+
netCDF::netcdf
95+
PROPERTIES
96+
IMPORTED_LOCATION "${NETCDF_LIBRARIES_C}"
97+
IMPORTED_LINK_INTERFACE_LANGUAGES C
98+
INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_INCLUDES}"
99+
)
100+
endif()
101+
if (NETCDF_FOUND AND NOT TARGET netCDF::netcdff)
102+
add_library(netCDF::netcdff UNKNOWN IMPORTED)
103+
set_target_properties(
104+
netCDF::netcdff
105+
PROPERTIES
106+
IMPORTED_LOCATION "${NETCDF_LIBRARIES_F90}"
107+
IMPORTED_LINK_INTERFACE_LANGUAGES Fortran
108+
INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_MODULES}"
109+
)
110+
target_link_libraries(netCDF::netcdff INTERFACE netCDF::netcdf)
111+
endif()
112+
91113
mark_as_advanced (NETCDF_LIBRARIES NETCDF_INCLUDES)

0 commit comments

Comments
 (0)