Skip to content

Commit

Permalink
Cleanup CCPP cmake build (#383)
Browse files Browse the repository at this point in the history
* Clean up ccpp/CMakeLists.txt, because the associated PRs for ccpp-framework and ccpp-physics now define their targets and dependencies correctly.
  • Loading branch information
climbfuji authored Sep 15, 2021
1 parent e5dfdd5 commit 85c2648
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
18 changes: 3 additions & 15 deletions ccpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ project(CCPP-FV3
LANGUAGES C CXX Fortran)
set(PROJECT "CCPP-FV3")

# Attempt to add link library "NetCDF::NetCDF_Fortran" to target "ccppphys"
# which is not built in this directory.
cmake_policy(SET CMP0079 NEW)

#------------------------------------------------------------------------------
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
Expand Down Expand Up @@ -94,12 +90,8 @@ endif()
# Build CCPP framework and physics

add_subdirectory(framework)

add_subdirectory(physics)
add_dependencies(ccppphys ccpp)
target_link_libraries(ccppphys PUBLIC w3nco::w3nco_d NetCDF::NetCDF_Fortran)
# This should not be necessary once framework and physics targets define BUILD_INTERFACE
target_include_directories(ccppphys PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/framework/src)
add_dependencies(ccpp_physics ccpp_framework)

#------------------------------------------------------------------------------
# Build fv3ccpp
Expand All @@ -124,16 +116,12 @@ add_library(
set_property(SOURCE driver/GFS_diagnostics.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "-O0")


target_link_libraries(fv3ccpp PUBLIC ccpp)
target_link_libraries(fv3ccpp PUBLIC ccppphys)
target_link_libraries(fv3ccpp PUBLIC ccpp_framework)
target_link_libraries(fv3ccpp PUBLIC ccpp_physics)

if(OPENMP)
target_link_libraries(fv3ccpp PUBLIC OpenMP::OpenMP_Fortran)
endif()

# This should not be necessary once framework and physics targets define BUILD_INTERFACE
target_include_directories(fv3ccpp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/framework/src
${CMAKE_CURRENT_BINARY_DIR}/physics)

set_target_properties(fv3ccpp PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod)
target_include_directories(fv3ccpp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/mod>)
2 changes: 1 addition & 1 deletion ccpp/framework
Submodule framework updated 2 files
+6 −30 CMakeLists.txt
+11 −11 src/CMakeLists.txt
2 changes: 1 addition & 1 deletion ccpp/physics
Submodule physics updated 1 files
+16 −41 CMakeLists.txt

0 comments on commit 85c2648

Please sign in to comment.