Replies: 9 comments 8 replies
-
Overall 👍. Just some minor details which would probably already be addressed in the actual PRs About the folder structure, I'm not sure how common Also, instead of |
Beta Was this translation helpful? Give feedback.
-
Crucial point that you should add: namespacing of options and targets. Currently it is inconsistent. Among those it is also important to check all cache variables such that no |
Beta Was this translation helpful? Give feedback.
-
Probably you are already familiar, but don't use FetchContent within |
Beta Was this translation helpful? Give feedback.
-
Thanks @K20shores, this looks really good! Maybe you could look at #2774, which I think is the minimal changes required to get I've found this CMake project template really useful, it has quite a few modules that can be dropped in, like coverage and sanitizers. Something that's not on your list that I think perhaps should be is removing all the global |
Beta Was this translation helpful? Give feedback.
-
I assume that this means that we specify options as "-DNETCDF_XXX". |
Beta Was this translation helpful? Give feedback.
-
Another possible thing to do is figure out how to remove the global |
Beta Was this translation helpful? Give feedback.
-
Remove uses of glob: https://github.com/Unidata/netcdf-c/pull/2847/files#r1468249196 |
Beta Was this translation helpful? Give feedback.
-
Create an interface library to replace |
Beta Was this translation helpful? Give feedback.
-
use build in modules to find the jpeg library: https://github.com/Unidata/netcdf-c/pull/2847/files#r1468245297 |
Beta Was this translation helpful? Give feedback.
-
Howdy!
As part of a pilot program between ACOM and Unidata with @WardF hosting me, I've been doing some work in the netCDF repository. I have some decent experience with cmake and the first (and maybe only thing since it's a short program) I am doing is trying to modernize cmake with the explicit goal of making consumption of netCDF by other projects easier, allowing
fetch_content
to be used, if it's not already available.Most of my knowledge has come from the book Professional CMake: A Practical Guide (which I highly recommend).
Much of what I'm doing will address some things in #2713.
Below is a list of PRs that I've already submitted and what they contained.
project
command which populates cmake internal variables and then uses them throughout the projectfetch_content
is making it easy for cmake to manage dependencies, or at least find them. This PR pulled all of the dependencies out of the top level cmake and placed them intocmake/depdendencies.cmake
cmake/netcdf_functions_macros.cmake
netcdf
cmake target to the top level directory so that things like compile defintions, linked libraries, and include directories are set only on the cmake target and not globallyHere a list of changes that I would to make over the remaining 2+ months that I have left. I'm listing them here so that the broader community can see what work is going on and comment about it so ensure that we arrive at a solution that works for everyone. I'm doing my best to keep the PRs small on purpose, though task 1. below will likely be the largest.
What I'm working on right now
as well as a recommended top level CMakeLists.txt setup, which you may recognize as something I'm working towards
Explicitly, at present I am attempting to place all packaging into the
packaging
directory so that netCDF could be built and delivered entirely within cmake. At the same time, I've had to define the netCDF library as a top level target earlier on than before so that compile definitions are not applied globally.This is a step in the direction of supporting #2843 since we would no longer need autotools to support libtools versioning.
Future
FindNetDDF.cmake
file if it doesn't already and test/fix anything that doesn't work withfetch_content
option
s near the top of the filefetch_content
if hdf5 supports this. If we can bump the version, thenfetch_content
will preferably use installed version of hdf5 before pulling it from git and compiling it from sourceset
commands used for working variables shortly after the theoptions
, but thisUp until this point I've just done things, mostly because they've been small. But moving forward I would like to create issues for each thing I do, since, you know, that's the better and more appropriate way to do things.
@WardF, @DennisHeimbigner, @LecrisUT, @edhartnett, @ZedThree I would appreciate any feedback or direction you'd like to give.
Cmake conventions:
NETCDF_
(needs to be appliedBeta Was this translation helpful? Give feedback.
All reactions