-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improve cmake for mingw #19
Conversation
Signed-off-by: Miloš Komarčević <miloskomarcevic@aim.com>
@jwsblokland could you please check that this works as intended with hdf5 on Windows? Thanks, Mathis |
@MathisRosenhauer Yes, everything works as intended. This is clearly an improvement. I knew I needed to do something special for Windows because of the clash of library name but I did not realize this only holds for MSVC. One of the advantages about CMake Config file is that you can still easily change things without effecting the CMake projects which makes use of libaec. Would it be an idea to increase the version number to, for example 1.0.6? |
Thanks @jwsblokland and thanks for the patch @kmilos. I will wait for a little while to see if any patches from Fedora or other distros come in and make a new release then. |
Btw, I wonder if the "_static" suffix was the best choice, it seems HDF5 looks for "-static"? |
Maybe not. However, if you have in the same directory both libsz.so and libsz-static.a (or libsz_static.a) their FindSZIP function will still choose libsz.so instead of the static one.. In my HPC environment we have typically both the static and shared libray installed. This is one of the reasons why I created a pull request HDFGroup/hdf5#703 in which I better integrate libaec into their CMake build system such one can easily switch between the shared and static library of libaec. |
Sure, and that's why I left the explicit filename+extension for the I'm just wondering for the legacy FindSZIP case (no libaec-config.cmake, no szip-config.cmake), maybe it's still better libaec switches to "-static" so we don't proliferate yet another naming convention? |
Thinking about it, I agree with you it is the better choice. |
Use CTest: it includes enable_testing() within, but also defines BUILD_TESTING option (on by default) that can be used to disable tests externally (could be useful for various CI build automation matrixes)
No need to specify prefixes and suffixes in find_library(), those are handled automatically depending on platform; it does make sense to ensure for the static linking case though
Test for MSVC rather than WIN32: MINGW also defines WIN32, but supports library naming (and a few other things) like UNIX, so no need to add tricks like "_static" (by default, on MINGW you'll get static libaec.a, shared libaec.dll and libaec.dll.a as import library not clashing with the static one)