Skip to content

toolchain-native.cmake and toolchain-cross.cmake#32

Merged
marler8997 merged 1 commit intomasterfrom
cmakeToolchains
Mar 3, 2026
Merged

toolchain-native.cmake and toolchain-cross.cmake#32
marler8997 merged 1 commit intomasterfrom
cmakeToolchains

Conversation

@marler8997
Copy link
Owner

It appears that cmake relys on the invoker to determine whether a toolchain is for native or cross-compilation. There doesn't appear to be a reliable way to cmake to determine this itself. So, we've split toolchain.cmake into a toolchain-native.cmake and toolchain-cross.cmake so the invoker can pick the right one. Note that the only difference between them is toolchain-cross.cmake includes two additional lines, setting the CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR, which, if done in a toolchain file automatically sets CMAKE_CROSSCOMPILING to true.

It appears that cmake relys on the invoker to determine whether a
toolchain is for native or cross-compilation.  There doesn't appear to
be a reliable way to cmake to determine this itself.  So, we've split
toolchain.cmake into a toolchain-native.cmake and toolchain-cross.cmake
so the invoker can pick the right one. Note that the only difference
between them is toolchain-cross.cmake includes two additional lines,
setting the CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR, which, if
done in a toolchain file automatically sets CMAKE_CROSSCOMPILING to true.
@marler8997 marler8997 merged commit d6f6e3f into master Mar 3, 2026
23 of 24 checks passed
@marler8997 marler8997 deleted the cmakeToolchains branch March 3, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant