the-tcpdump-group / tcpdump

the TCPdump network dissector
https://www.tcpdump.org/
Other
2.7k stars 842 forks source link

cmake: treat building for another ISA as a cross-compile. #1220

Closed guyharris closed 1 week ago

guyharris commented 2 weeks ago

CMake appears to have the notion that a build is only a cross-compile if the targt operating system is different. This is an incorrect notion, as even if the target is the same OS but a different instruction set, you may not be able to do tests that involve compiling and running a program.

Check whether CMAKE_GENERATOR_PLATFORM is set and has a value different from that of CMAKE_HOST_SYSTEM_PROCESSOR and, if that's the case, set CMAKE_CROSSCOMPILING to TRUE.

This comes from libpcap, where the equivalent change fixed issue the-tcpdump-group/libpcap#1352.

(A different strategy may be necessary for cross-builds with UNIX toolchains.)