Closed ghost closed 3 years ago
Looks fine to me, but I'm curious why the tests are disabled by default? Is it a common practice? I'm fine either way, but I'm usually reluctant to introduce incompatible changes. The tests were enabled by default in the previous versions, so I'm not sure it's a good idea to change existing behavior with no good reason.
On the other hand, if we make it ON by default, then we'll break builds on systems that lack QtTest for whatever reason? Then maybe it's a sensible default to leave it OFF.
Looks fine to me, but I'm curious why the tests are disabled by default? Is it a common practice?
Yes, people tend to disable tests by default, because it's usually expected that the user of the library doesn't need them at all, it's just for the developer. Take a look at the spdlog
library for example.
Back in the ./configure
age, it was the opposite: the user was expected to make check
after a successful build, to ensure that the library works as intended on their specific systems with specific build settings.
But since nothing stops the user from building the tests manually anyway, I guess it doesn't matter much. Plus, when a project is used as a subdirectory, building tests is probably more of a nuisance.
All right, I'm merging it as it is.
Motivation
The user of the library should be able to turn
QUAZIP_ENABLE_TESTS
off.Solution
We can do it by making an
option
ofQUAZIP_ENABLE_TESTS
. In addition,QUAZIP_ENABLE_TESTS
shouldn't be set from the inside, thus setting it toON
statements are removed.Now to build QuaZIP with tests just pass
-DQUAZIP_ENABLE_TESTS=ON
to CMake configure, or if you want to do it as a part of the project, then useset(QUAZIP_ENABLE_TESTS ON
).Resolves #119.