Skip to content

Commit 0784ad1

Browse files
committed
more changes suggested by hammpie
1 parent fa631bc commit 0784ad1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@ foreach (SRC_FILE IN LISTS CPRNC_GenF90_SRCS)
7676
endforeach ()
7777

7878
#===== NetCDF =====
79-
pkg_check_modules(NetCDF REQUIRED netcdf)
79+
pkg_check_modules(NetCDF REQUIRED IMPORTED_TARGET netcdf)
8080

8181
#===== NetCDF-Fortran =====
82-
pkg_check_modules(NetCDF_Fortran REQUIRED netcdf-fortran)
82+
pkg_check_modules(NetCDF_Fortran REQUIRED IMPORTED_TARGET netcdf-fortran)
8383
add_executable (cprnc ${CPRNC_Fortran_SRCS} ${CPRNC_GenF90_SRCS})
84-
target_include_directories(cprnc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${NetCDF_Fortran_INCLUDE_DIRS})
84+
target_include_directories(cprnc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
8585

8686
add_dependencies (cprnc genf90)
8787

8888
# Always use -fPIC
8989
set_property(TARGET cprnc PROPERTY POSITION_INDEPENDENT_CODE ON)
9090
target_link_libraries (cprnc
91-
PUBLIC ${NetCDF_Fortran_LIBRARIES} ${NetCDF_LIBRARIES})
91+
PUBLIC PkgConfig::NetCDF_Fortran PkgConfig::NetCDF)
9292

9393
# We do not want cprnc injecting ctests into parent projects
9494
if (CPRNC_STANDALONE)

0 commit comments

Comments
 (0)