Skip to content

Improve CMake detection of whether NetCDF is found#30

Merged
billsacks merged 1 commit into
ESMCI:mainfrom
billsacks:fix_netcdf_find
Oct 16, 2025
Merged

Improve CMake detection of whether NetCDF is found#30
billsacks merged 1 commit into
ESMCI:mainfrom
billsacks:fix_netcdf_find

Conversation

@billsacks

@billsacks billsacks commented Oct 16, 2025

Copy link
Copy Markdown
Member

Without this fix, the build on my Mac finds a netCDFConfig.cmake file (rather than a FindNetCDF.cmake file) that causes entrance into the wrong block.

Resolves #29

Fix suggested by @bartgol

Without this fix, the build on my Mac finds a netCDFConfig.cmake file
(rather than a FindNetCDF.cmake file) that causes entrance into the
wrong block.

Resolves ESMCI#29

Co-authored-by: Luca Bertagna <lbertag@sandia.gov>
@billsacks

Copy link
Copy Markdown
Member Author

@bartgol - FYI

In addition to my Mac, I have tested this on NSF NCAR's derecho system; the cprnc build still works there, though it was entering the else block even before this change. I also tried the build on NSF NCAR's izumi system, but I can't get the cprnc build to work there before or after this change.

It would be great if someone could test this somewhere where we expect to enter the block where netcdf is found (i.e., the if block rather than the else block associated with this change).

@billsacks

Copy link
Copy Markdown
Member Author

@bartgol - I can't add you as a reviewer, but I'll wait to merge this until you give your official go-ahead, since you're the one who suggested this change. If you have a way to test this on a system where we should enter the first block (where netcdf is found) that would make me feel better, but if you're fairly confident in this change without that, I'm okay moving ahead with merging it with your "okay".

@bartgol

bartgol commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

I am trying this branch within e3sm, to verify it works as expected.

Edit: on my machine, it picks up the "else" branch of the outermost if. But that's what it was picking up before anyways.

Imho, this can be merged. E3SM has cprnc pre-installed in most production machines anyways, so the risk of bad impacts is minimal. Besides, as I said on the issue page, I think this mod is conceptually more correct, since the find pkg call is explicitly listing the components.

@billsacks

Copy link
Copy Markdown
Member Author

Okay, thanks, @bartgol !

@billsacks billsacks merged commit 19bbb1e into ESMCI:main Oct 16, 2025
1 check passed
@billsacks billsacks deleted the fix_netcdf_find branch October 16, 2025 21:18
billsacks added a commit to ESMCI/cime that referenced this pull request Oct 21, 2025
Update cprnc from v1.1.3 to v1.1.4

Main change is a fix to the CMake build fo NetCDF: ESMCI/cprnc#30

Also includes fix to a typo in the README: ESMCI/cprnc#26
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.

Can't get recent versions of cprnc to build on my Mac due to problems finding netcdf

3 participants