-
-
Notifications
You must be signed in to change notification settings - Fork 96
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 improvements #151
CMake improvements #151
Conversation
0b0245a
to
07cfd2c
Compare
Thanks again. I was constantly failing in configuring the conan recipe to find the proper hdf5 dependency. With these fixes (and my above change setting H5_BUILT_AS_DYNAMIC_LIB as pre-processor define it is finally working, no matter if shared/static matio links shared/static hdf or whatsoever. |
b4ac20c
to
d578fdb
Compare
Have you tried a clean build? For me it is just |
Yes, deleted all and started a fresh build with same result. CMake is 3.18.2 and Conan is 1.28.1. |
Maybe it is an issue with Conan. Can you add the following at line 54 in get_target_property(definitions hdf5::hdf5-shared INTERFACE_COMPILE_DEFINITIONS)
message("${definitions}") For me it prints: |
It always uses the else branch: # results from CMake FindHDF5
set_target_properties(HDF5::HDF5 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${HDF5_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${HDF5_LIBRARIES}"
INTERFACE_COMPILE_DEFINITIONS "${HDF5_DEFINITIONS}"
) Maybe it is due to Conan not distributing the CMake settings, but only include files, libs and executables. |
Indeed, it does not seem to have the cmake config files. But I could reproduce it and hopefully fix it. |
Confirmed. It is working now. Thanks a lot! |
05d4edb
to
e1d4b17
Compare
The config files require an exact version match. Also use the provided targets directly. Define H5_BUILT_AS_DYNAMIC_LIB when HDF5 1.8 config file is used.
User can override it by setting HDF5_USE_STATIC_LIBRARIES themselves. Also add an attempt to find the static zlib library, since FindZLIP does not do this.
e1d4b17
to
68d5c24
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work. Thank you.
Argh, too early. There is a warning in https://travis-ci.org/github/tbeu/matio/jobs/724596042
and later when testing
Thus, it does not seem to correctly build with zlib if used from hdf5. |
This fixes using the
hdf5-config.cmake
provided by the HDF5 package. This didn't work correctly because it checked for an exact version match.I now automatically select static HDF5 (and zlib/szip) libraries when building static matio.
Another idea is adding an optionA user can specifyMATIO_HDF5_LIBRARY_TYPE
with choicesdefault
,shared
andstatic
. What do you think?HDF5_USE_STATIC_LIBRARIES
themselves to override it.