Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

guyharris
Copy link
Member

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.)

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.)
@guyharris guyharris merged commit 2dd4547 into the-tcpdump-group:master Sep 22, 2024
19 checks passed
@guyharris guyharris deleted the other-isa-same-os-is-a-crosscompile branch September 22, 2024 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant