Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif()
project (cprnc Fortran C)
include (CheckFunctionExists)
include (ExternalProject)
find_package(PkgConfig REQUIRED)

#===== Local modules =====
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
Expand Down Expand Up @@ -74,17 +75,20 @@ foreach (SRC_FILE IN LISTS CPRNC_GenF90_SRCS)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE}.in genf90)
endforeach ()

#===== NetCDF =====
pkg_check_modules(NetCDF REQUIRED IMPORTED_TARGET netcdf)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


#===== NetCDF-Fortran =====
INCLUDE(FindNetCDF)
pkg_check_modules(NetCDF_Fortran REQUIRED IMPORTED_TARGET netcdf-fortran)
add_executable (cprnc ${CPRNC_Fortran_SRCS} ${CPRNC_GenF90_SRCS})
target_include_directories(cprnc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${NetCDF_Fortran_INCLUDE_DIRS})
target_include_directories(cprnc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

add_dependencies (cprnc genf90)

# Always use -fPIC
set_property(TARGET cprnc PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries (cprnc
PUBLIC ${NetCDF_Fortran_LIBRARIES} ${NetCDF_C_LIBRARIES} ${NetCDF_LIBRARIES})
PUBLIC PkgConfig::NetCDF_Fortran PkgConfig::NetCDF)

# We do not want cprnc injecting ctests into parent projects
if (CPRNC_STANDALONE)
Expand Down
96 changes: 0 additions & 96 deletions cmake/FindNetCDF.cmake

This file was deleted.

143 changes: 0 additions & 143 deletions cmake/FindNetCDF.cmake~

This file was deleted.

104 changes: 0 additions & 104 deletions cmake/LibCheck.cmake

This file was deleted.

Loading
Loading