Fix dumpcap build on platforms where isfinite() is in libm.
authorGuy Harris <gharris@sonic.net>
Wed, 6 Dec 2023 09:37:50 +0000 (01:37 -0800)
committerGuy Harris <gharris@sonic.net>
Wed, 6 Dec 2023 09:37:50 +0000 (01:37 -0800)
dumpcap is statically linked with libwsutil and, in the main branch,
uses the JSON dumper code in that library.  This means that linking with
libwsutil causes the object file for the JSON dumper to be included, and
that code calls isfinite().

As this is linking with a *static* libwsutil, and as, on most if not all
platforms, a static library, unlike a dynamic library, doesn't include
an indication of other libraries on which the library depends, linking
statically with libwsutil does not cause the code that's being linked to
link with those other libraries.

If isfinite() is in the standard system library (as it appears to be in
macOS), that's not a problem.

However, if it's in libm (as it appears to be in FreeBSD), that *is* a
problem, as it means dumpcap needs to be linked with libm.  Make it so.

CMakeLists.txt

index e10df0e04abb033091eb24acb74f00b9eaa8775b..a5f2b25eb9c25708f4c1fc7b604b536e4845c47d 100644 (file)
@@ -3297,6 +3297,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
                ${APPLE_CORE_FOUNDATION_LIBRARY}
                ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
                ${WIN_WS2_32_LIBRARY}
+               ${M_LIBRARIES}
        )
        if(UNIX)
                list(APPEND CAPUTILS_SRC