Skip to content

Commit

Permalink
back to pkgconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
harshula committed Feb 26, 2025
1 parent 0474cba commit 7ac2cde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 345 deletions.
15 changes: 7 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|IntelLLVM)$")
WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}")
endif()

# TODO: Include FindNetCDF.cmake , there must be a better way to do this!
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

################################################################################
# Fortran
################################################################################
Expand Down Expand Up @@ -176,7 +173,9 @@ endif()

# Find dependencies
find_package(MPI REQUIRED COMPONENTS C Fortran)
find_package(NetCDF REQUIRED COMPONENTS C Fortran)
find_package(PkgConfig REQUIRED)
pkg_check_modules(NETCDF_C REQUIRED IMPORTED_TARGET "netcdf")
pkg_check_modules(NETCDF_F REQUIRED IMPORTED_TARGET "netcdf-fortran")

# Check for the OpenMP library and set the required compile flags
if (OPENMP)
Expand Down Expand Up @@ -379,7 +378,7 @@ foreach(kind ${kinds})

target_compile_definitions(${libTgt}_c PRIVATE "${fms_defs}")

target_link_libraries(${libTgt}_c PRIVATE NetCDF::NetCDF_C
target_link_libraries(${libTgt}_c PRIVATE PkgConfig::NETCDF_C
MPI::MPI_C)

if(OpenMP_C_FOUND)
Expand All @@ -403,7 +402,7 @@ foreach(kind ${kinds})
set_target_properties(${libTgt}_f PROPERTIES Fortran_MODULE_DIRECTORY
${moduleDir})

target_link_libraries(${libTgt}_f PRIVATE NetCDF::NetCDF_Fortran
target_link_libraries(${libTgt}_f PRIVATE PkgConfig::NETCDF_F
MPI::MPI_Fortran)

if(OpenMP_Fortran_FOUND)
Expand Down Expand Up @@ -443,8 +442,8 @@ foreach(kind ${kinds})
target_compile_definitions(${libTgt} PRIVATE "${fms_defs}")
target_compile_definitions(${libTgt} PRIVATE "${${kind}_defs}")

target_link_libraries(${libTgt} PUBLIC NetCDF::NetCDF_C
NetCDF::NetCDF_Fortran
target_link_libraries(${libTgt} PUBLIC PkgConfig::NETCDF_C
PkgConfig::NETCDF_F
MPI::MPI_Fortran)

if(OpenMP_Fortran_FOUND)
Expand Down
337 changes: 0 additions & 337 deletions cmake/FindNetCDF.cmake

This file was deleted.

0 comments on commit 7ac2cde

Please sign in to comment.