Page MenuHomePhabricator

[test-suite] ClamAV CMake fix.
ClosedPublic

Authored by naromero77 on Dec 11 2020, 11:33 AM.

Details

Summary

CMake needs help finding gettext libintl libraries in environments with non-standard GCC installs.

Event Timeline

naromero77 created this revision.Dec 11 2020, 11:33 AM
naromero77 requested review of this revision.Dec 11 2020, 11:33 AM
Meinersbur requested changes to this revision.Dec 14 2020, 8:02 AM

Usually system introspection happens in the top-level CMakeLists.txt, but test-suite allows to selectively include subdirs, so it is a good location to do here.

If ClamAV is using gettext only, maybe use FindGettext instead?

MultiSource/Applications/ClamAV/CMakeLists.txt
173
This revision now requires changes to proceed.Dec 14 2020, 8:02 AM

The CMake documentation says to use FindIntl for the gettext libintl libraries
https://cmake.org/cmake/help/latest/module/FindIntl.html#module:FindIntl

but use FindGettext for tools (msmerge, msgfmt, etc.).

ClamAV is only using the former.

You are right, FindGettext seems to look for some commands, not the library.

Can you still do the find_package change?

MultiSource/Applications/ClamAV/CMakeLists.txt
173
  • Use find_package instead.
This revision is now accepted and ready to land.Dec 15 2020, 11:00 PM
naromero77 closed this revision.Dec 16 2020, 8:45 PM

This seems to have caused failures on Darwin platforms. I've pushed a fix in 48e7b34f but let me know if you disagree with the approach.

I would have done an unequal: if (NOT TARGET_OS STREQUAL "Darwin"). libIntl is part of the GNU user space environment, not the kernel, e.g. also apply to GNU/kFreeBSD.

More generally, IMHO cmake should have abstracted over this, for platforms that don't need libIntl.