Building with local hdf5 created with FetchContent #741
-
I am having a lot of trouble building with a local hdf5 I build using FetchContent. First and foremost, the CMake recommended way does not work (unless you have a nice environment where you can have a really recent CMake that supports the new FetchContent_Declare(hdf5
GIT_REPOSITORY https://github.com/HDFGroup/hdf5
GIT_TAG hdf5-1_12_0
)
FetchContent_Declare(HighFive
GIT_REPOSITORY https://github.com/BlueBrain/HighFive
GIT_TAG v2.7.1
)
FetchContent_MakeAvailable(hdf5 HighFive) fails because FetchContent has not set the variables
you get a bunch of errors, because HighFive's dependencies are added as part of an interface library. This assumes that the local HDF5 is bad:
which also happens even if I just use a git submodule for HighFive, and forego FetchContent. It doesn't matter. It's the local hdf5 it doesn't like. I can try to fix this by using a generator expression:
but once again that fails because it's unquoted in
I tried escaping the quotes several different ways, and nothing worked. Finally, I can fix it by adding quotes to the line above:
Except now I've negated the entire reason for using FetchContent or a git submodule, because I have to modify the source. I can't think I'm the only one who has run into this issue. Anyone attempting to avoid "dependency hell" and build a local, static build environment that links to a specific HDF5 will run into this. Is there an obvious workaround I'm missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I mean, I guess there's the obvious route of just adding the git submodule directory to the target include directories directly, but that feels a little hacky. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, I'm unable to get it to run even as far as you. For me it errors out on
What I would have wanted to check is what happens if we replace the use of Do you have a complete Note, I've also tried #745 which only includes HighFive via FetchContent, but (presumably) assumes that HDF5 is preinstalled. That part, i.e. the part of using FetchContent to get HighFive and use is via its target |
Beta Was this translation helpful? Give feedback.
I mean, I guess there's the obvious route of just adding the git submodule directory to the target include directories directly, but that feels a little hacky.