-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix: Make tests optional #691
Conversation
It'd be great to be able to disable the tests when using this project as a submodule. I'm spending more time than I would like attempting to get these tests found by ctest so I can get back to working on other stuff. Just being able to disable them since they do not pertain to our project would be great. |
@madler, would you please look at this when you have time? We are currently forced to use a fork of zlib because of CMake issues like this. |
Can you just do |
Actually, I just ran across this in another repository. Here is the associated Kitware issue: https://gitlab.kitware.com/cmake/cmake/-/issues/20212. Alternatively, you could use zlib-ng which has options to disable testing, but it doesn't fix the problem for this repo. |
Yes, thank you for bringing this up. My PR description was poor, and should have had those details. Here is what happens with EXCLUDE_FROM_ALL, but without this PR:
|
I updated the PR description with more detail on why this is necessary. Thanks, @nmoinvaz, for the link to the cmake issue tracker! |
f764f16
to
9585b9f
Compare
9585b9f
to
675d804
Compare
When including zlib as a submodule, it is useful to be able to disable the tests. EXCLUDE_FROM_ALL when including zlib will prevent tests from being automatically built, but cmake will still attempt to run them, resulting in a test failure. This problem is discussed in https://gitlab.kitware.com/cmake/cmake/-/issues/20212, but after 2 years, there is no obvious consensus on a fix. So it should be up to the library to be responsible and use the BUILD_TESTING variable to guard their calls to add_test().
675d804
to
d8fb711
Compare
The change is now backward compatible for the sake of those who depend on the example and minigzip binaries. Only the Thanks! |
Bumping as this thread has not seen activity for a few months. |
@madler: What do you think? |
Bumping as this thread has not seen activity for a few months. |
A fix like this has been applied. |
Thank you! |
When including zlib as a submodule, it is useful to be able to disable the tests.
EXCLUDE_FROM_ALL when including zlib will prevent tests from being automatically built, but cmake will still attempt to run them, resulting in something like this from
make test
in the host project:This is discussed in https://gitlab.kitware.com/cmake/cmake/-/issues/20212, but after 2 years, there is no obvious consensus on a fix. So it should be up to the library to be responsible and use the
BUILD_TESTING
variable to guard their calls to add_test().