Skip to content

Changes to CMakeLists.txt for FMS#243

Closed
mlee03 wants to merge 2 commits into
NOAA-EMC:developfrom
mlee03:fms/cmake_changes
Closed

Changes to CMakeLists.txt for FMS#243
mlee03 wants to merge 2 commits into
NOAA-EMC:developfrom
mlee03:fms/cmake_changes

Conversation

@mlee03
Copy link
Copy Markdown

@mlee03 mlee03 commented Feb 1, 2021

Description

This PR updates CMakeLists.txt, io/CMakeLists.txt, and stochastic_physics/CMakeLists.txt to be compatible with the FMS CMakeLists.txt. The fms target has been changed to FMS::fms_r4 for 32BIT or FMS::fms_r8 for a 64BIT compilation. This change is necessary for the UFS Weather Model to use the FMS CMakeLists.txt file. Answer changes are not expected.

Issue(s) addressed

Testing

Regression tests are currently running after making last minute minor changes.

Dependencies

@mlee03
Copy link
Copy Markdown
Author

mlee03 commented Feb 1, 2021

@aerorahul,

could you review to make sure everything looks ok? Thank you!

@mlee03 mlee03 marked this pull request as ready for review February 1, 2021 15:25
Comment thread io/CMakeLists.txt
Comment on lines +34 to +42
if(32BIT)
target_link_libraries(io PRIVATE FMS::fms_r4
gfsphysics
ccppdriver)
else()
target_link_libraries(io PRIVATE FMS::fms_r8
gfsphysics
ccppdriver)
endif()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is fine for now, but in the subsequent PR's we could use an alias target when FMS is provided as a module or "third-party library" or built in the UFS (as is the case now).
This can be achieved by something like this in the UFS:

find_package(FMS QUIET)
if (FMS_FOUND)
  if (32BIT)
    add_library(fms ALIAS FMS::fms_r4)
  else()
    add_library(fms ALIAS FMS::fms_r8)
  endif()
else()
  add_subdirectory(FMS)
  if (32BIT)
    add_library(fms ALIAS FMS::fms_r4)
  else()
    add_library(fms ALIAS FMS::fms_r8)
  endif()
endif()

All downstream targets can then use fms without the need for and if-else block scattered everywhere.

Copy link
Copy Markdown
Contributor

@aerorahul aerorahul left a comment

Choose a reason for hiding this comment

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

Changes look good to me. Please look at my comment and check to see if that works. I have not tried it myself and it may need a slight tweaking, but that is the general concept in using that ALIAS target.

@mlee03
Copy link
Copy Markdown
Author

mlee03 commented Feb 5, 2021

This change is not necessary.

@mlee03 mlee03 closed this Feb 5, 2021
LarissaReames pushed a commit to LarissaReames/fv3atm that referenced this pull request Nov 17, 2023
* only send w to CCPP physics in non-hydrostatic mode, and only if the physics wants it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update CMakeLists.txt for FMS

2 participants