-
Notifications
You must be signed in to change notification settings - Fork 163
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
Switching to modern CMake #257
Conversation
P.S.
|
Hi Tom. Thanks for your effort. Improvement of CMake is always welcomed. Feel free to play around, but I'm more in favor of using this as a "reference" to take ideas from and apply them little by little to the current build. |
@ferdonline I think that modernising CMake does not have to break the current functionality: having |
@ferdonline Beyond the namespace maybe you can explain your comments a bit further? Maybe you can list some examples of functionality that should be kept (except of course testing and compile examples, that should obviously be integrated). |
I support the initiative of @tdegeus to switch to a modern cmake. |
Edited based on the comment on the namespace below.
I started playing around with modern CMake. I think it could be very interesting here as it gives a lot of room for flexible automatic dependencies and customisation by the end-user. I have prepared a first version that for now only installs the library and provides CMake support for the end-user. I've left out testing, examples, ... because at the moment I think it is good to first discuss.
The point here is that a target
HighFive
is exported that contains the headers of the library itself, and includes targets for the required dependency (HighFive::HDF5
) and optional dependencies (HighFive::Boost
,HighFive::Eigen
, andHighFive::xtensor
). At compile time, these targets need to be defined, but their content allows for flexibility. The user can define them, or, when they are not defined, they are filed inHighFiveConfig.cmake
depending on availability of the optional dependencies. If the libraries are found the defines (H5_USE_BOOST
, ...) are also set to the relevant target (HighFive::Boost
, ...).For testing, I suggest a conda environment. Then install (in the activated environment) by
One can then run an example:
with the following
CMakeLists.txt
Notice that depending on availability Boost, Eigen3, and xtensor will be auto-activated.