CMake: Use namespaced target name for netCDF-C library

This commit is contained in:
Peter Hill 2020-05-16 13:49:25 +01:00
parent e293307a2c
commit 8f2b4f2b34
3 changed files with 7 additions and 7 deletions

View File

@ -376,9 +376,9 @@ ELSE()
ENDIF()
if (NOT TARGET netcdf)
add_library(netcdf UNKNOWN IMPORTED)
set_target_properties(netcdf PROPERTIES
if (NOT TARGET netCDF::netcdf)
add_library(netCDF::netcdf UNKNOWN IMPORTED)
set_target_properties(netCDF::netcdf PROPERTIES
IMPORTED_LOCATION "${NETCDF_C_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_C_INCLUDE_DIR}"
)

View File

@ -33,7 +33,7 @@ TARGET_INCLUDE_DIRECTORIES(netcdf-cxx4 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
TARGET_LINK_LIBRARIES(netcdf-cxx4 PUBLIC netcdf)
TARGET_LINK_LIBRARIES(netcdf-cxx4 PUBLIC netCDF::netcdf)
TARGET_LINK_LIBRARIES(netcdf-cxx4 PUBLIC ${ALL_TLL_LIBS})
target_include_directories(netcdf-cxx4 SYSTEM PUBLIC "${HDF5_C_INCLUDE_DIRS}")

View File

@ -18,9 +18,9 @@ else()
set(NETCDF_C_INCLUDE_DIR "@NETCDF_C_INCLUDE_DIR@")
endif()
if (NOT TARGET netcdf)
add_library(netcdf UNKNOWN IMPORTED)
set_target_properties(netcdf PROPERTIES
if (NOT TARGET netCDF::netcdf)
add_library(netCDF::netcdf UNKNOWN IMPORTED)
set_target_properties(netCDF::netcdf PROPERTIES
IMPORTED_LOCATION "${NETCDF_C_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_C_INCLUDE_DIR}"
)