Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake Better nf-config libdir detection #2161

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

islas
Copy link
Collaborator

@islas islas commented Jan 27, 2025

TYPE: enhancement

KEYWORDS: cmake, netcdf, netcdf-fortran, nf-config

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
As nf-config does not provide an equivalent --libdir output we must derive the info ourselves. --flibs provided the info previously, but it may be more practical to use the --prefix output and search suspected suffixes instead as --flibs contains other libraries' link info.

Solution:
Use output of --prefix from nf-config as the primary source of library dir. To handle the cases where --prefix is empty, we still fall back to --flibs and if that proves insufficient then the as a last resort one directory above the include directory can be used as a substitute for the prefix.

TESTS CONDUCTED:

  1. Tested with netCDF-Fortran v4.6.2, modifying nf-config to emulate fallback if clauses

RELEASE NOTE: Better nf-config libdir detection in CMake build

As nf-config does not provide an equivalent --libdir output we must
derive the info ourselves. --flibs provided the info previously, but it
may be more practical to use the --prefix output and search suspected
suffixes instead as --flibs contains other libraries' link info. To
handle the cases where --prefix is empty, we still fall back to --flibs
and if that proves insufficient then the as a last resort one directory
above the include directory can be used as a substitute for the prefix.
@islas islas requested a review from a team as a code owner January 27, 2025 21:53
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.

1 participant