BUILD_TESTING changes what gets installed: libconky_core.a ships with the package
What happened?
Turning on BUILD_TESTING also installs a static library. src/CMakeLists.txt
has, at ef154d5 lines 520-537:
if(BUILD_TESTING)
# Create a library strictly for testing
add_library(conky_core ${conky_sources} ${optional_sources})
...
install(TARGETS conky_core
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})The comment says the library exists strictly for testing, but it is installed
unconditionally within that branch. So a distribution that wants to run the test
suite at package time gets usr/lib/libconky_core.a in the shipped package as a
side effect.
Measured on conky 1.22.3 with Arch's package build, same sources and flags
otherwise, only BUILD_TESTING differing:
tests off: 43 files packaged
tests on: 44 files packaged, the extra one usr/lib/libconky_core.a!staticlibs, the makepkg option that normally strips static libraries, does not
remove it, because there is no matching shared library.
Why it matters
It makes "run the tests" and "change the installed artifacts" the same switch.
Distributions then have to carry a manual rm in their packaging, which is what
Arch's conky package will need to do. Anyone who enables the suite without
noticing ships the static library.
Suggested fix
Drop the install(TARGETS conky_core ...) block, or guard it behind its own
option that defaults off, so BUILD_TESTING only controls whether tests are
built and run.
Happy to send a PR if you agree on which of those you would prefer.
Version
ef154d5, and the same shape is present in 1.22.3.
Source: brndnmtthws/conky