Provide Transient Properties on netCDF Library#1540
Conversation
Modern CMake tracks the properties of targets so that down stream libraries do not have to worry about include directories. However, the include directories must be added to the target and not just at the directory level.
The usual convention with modern CMake is to namespace the targets. This gives the netCDF namespace to the package.
The changes to netCDF have been submitted as a [PR](Unidata/netcdf-c#1540). This update is a temporary fix while the request is reviewed.
|
Thanks! |
|
It just dawned on me that I might have gotten in my own way with the namespacing. The second commit could break downstream builds that rely on the library being named |
|
I just checked, and CMake usage works with both As a followup, should a note on usage with CMake be added to a particular part of the documentation? This pull request notes how to use netCDF in a CMake build, but I don't see anywhere in the documentation that looks appropriate. |
The patch that was referenced in the CMakeLists was [merged upstream][merge]. [merge]: Unidata/netcdf-c#1540
CMake provides the means to track the transient dependencies of a library, like its include directories, by setting the appropriate property on the target(s). This pull request does two things. The first add the include directories to the
netcdflibrary so that downstream usage only requires adding the link library. Specificallybecomes
This helps CMake to correctly track the implicit dependencies and get linking orders correct.
The second change (second commit) is adding a namespace for the netCDF targets. Namespaces are advised by most tutorials (I'm thinking this one in particular), but are in reality not critical.
Closes #1539