Skip to content

Remove Findwgrib2.cmake; use config from package instead#125

Draft
AlexanderRichert-NOAA wants to merge 4 commits intoNOAA-EMC:developfrom
AlexanderRichert-NOAA:cmake_wgrib2
Draft

Remove Findwgrib2.cmake; use config from package instead#125
AlexanderRichert-NOAA wants to merge 4 commits intoNOAA-EMC:developfrom
AlexanderRichert-NOAA:cmake_wgrib2

Conversation

@AlexanderRichert-NOAA
Copy link
Copy Markdown

@AlexanderRichert-NOAA AlexanderRichert-NOAA commented Aug 7, 2025

Description

This PR removes Findwgrib2.cmake, instead using the wgrib2:wgrib2_ftn_api target defined in the package's CMake config.

Resolves #121

Type of change

  • Maintenance (code refactor, clean-up, new CI test, etc.)

Change characteristics

  • Is this a breaking change (a change in existing functionality)? NO
  • Does this change require a documentation update? NO (not that I know of)

How has this been tested?

  • Builds on Gaea C6

Checklist

  • Any dependent changes have been merged and published
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing tests pass with my changes
  • I have made corresponding changes to the documentation if necessary

@AlexanderRichert-NOAA
Copy link
Copy Markdown
Author

@aerorahul as far as WCOSS2, I believe the wgrib2 there has a cmake config with a different target name (just "wgrib2::wgrib2"), and the module does not automatically set CMAKE_PREFIX_PATH. Do you want me to try to add some logic to make it work there (maybe add $wgrib2_ROOT to $CMAKE_PREFIX_PATH in module-setup.sh then select CMake target name based on wgrib2 version)?

@aerorahul
Copy link
Copy Markdown
Contributor

I think the wgrib2 module provides the wgrib2_ROOT variable, and cmake should be able to use that to find the cmake config, if it is in the standard locations. If not, then yeah CMAKE_PREFIX_PATH should be appended to provide the location of the cmake config.

The target name is a different issue. This PR is making use of the target wgrib2::wgrib2_ftn_api, which I presume is the preferred one going forward (or is it wgrib2::wgrib2)?

Is the WCOSS2 installation an older one (before spack stack), and if we are going to move to ss-1.9.2, we can wait a bit for all installations to be consistent and have the same target.
Thoughts?

Also tagging @DavidHuber-NOAA

@AlexanderRichert-NOAA
Copy link
Copy Markdown
Author

Good point re: "wgrib2_ROOT", I'll try a test with that.

@AlysonStahl-NOAA, can you confirm that wgrib2::wgrib2_ftn_api is the preferred target name and will be used going forward? To your question @aerorahul, yes, on WCOSS2 currently it's an older version where the target name is just wgrib2::wgrib2.

I'm going to try setting it up where it will automatically detect which of the two target names is available, but if that proves too complicated we can just choose one based on whatever Alyson tells us, anticipating getting a more recent wgrib2 through spack-stack.

@aerorahul
Copy link
Copy Markdown
Contributor

@AlexanderRichert-NOAA
I suggest we just wait for the spack-stack on WCOSS2. It seems to be very close to it.

@AlexanderRichert-NOAA
Copy link
Copy Markdown
Author

Fine with me

@AlysonStahl-NOAA
Copy link
Copy Markdown

@AlexanderRichert-NOAA Yes, that should be the name going forward. I'll make sure there are no unexpected target name changes in future releases.

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.

Remove Findwgrib2.cmake from this repository and use wgrib2 supplied package targets

3 participants