Skip to content

Commit

Permalink
Suggestions from Micael
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanBryan51 committed Jan 19, 2024
1 parent ed790d5 commit ba12bba
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(
option(CABLE_MPI "Build the MPI executable" OFF)

set(
srcs_common
CABLE_SRCS_COMMON
src/science/casa-cnp/bgcdriver.F90
src/science/casa-cnp/biogeochem_casa.F90
src/offline/cable_abort.F90
Expand Down Expand Up @@ -123,36 +123,34 @@ find_package(PkgConfig REQUIRED)

pkg_check_modules(NETCDF REQUIRED IMPORTED_TARGET "netcdf-fortran")

if(NOT CABLE_MPI)
add_executable(
cable
src/offline/cable_driver.F90
${srcs_common}
)

# third party libs
target_link_libraries(
cable
PkgConfig::NETCDF
)

install(TARGETS cable)
else()
add_executable(
cable-mpi
if(CABLE_MPI)
set(
CABLE_SRCS
src/offline/cable_mpidrv.F90
src/offline/cable_mpicommon.F90
src/offline/cable_mpimaster.F90
src/offline/cable_mpiworker.F90
src/science/pop/pop_mpi.F90
${srcs_common}
${CABLE_SRCS_COMMON}
)

# third party libs
target_link_libraries(
cable-mpi
PkgConfig::NETCDF
set(CABLE_EXE_NAME cable-mpi)
else()
set(
CABLE_SRCS
src/offline/cable_driver.F90
${CABLE_SRCS_COMMON}
)

install(TARGETS cable-mpi)
set(CABLE_EXE_NAME cable)
endif()

add_executable(cable ${CABLE_SRCS})

set_target_properties(cable PROPERTIES OUTPUT_NAME ${CABLE_EXE_NAME})

# third party libs
target_link_libraries(
cable
PkgConfig::NETCDF
)

install(TARGETS cable RUNTIME)

0 comments on commit ba12bba

Please sign in to comment.