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. #1353

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,28 @@ else (USE_STATIC_RT)
message(STATUS "Use DYNAMIC runtime")
endif(USE_STATIC_RT)

#
# CMake's definition of "cross-compiling" appears to be "compiling
# for an *operating system* other than the one on which the build
# is being done*.
#
# This is an inadequate definition, as people build for the same
# operating system but a different instruciton set, e.g. building
# on an IA-32 or x86-64 Linux box for an Arm embedded Linux box,
# or building Arm code on an IA-32 or x86-64 Windows box.
#
# At least for the Windows case, people may do those builds by
# setting the target with th -A flag to CMake; that causes
# CMAKE_GENERATOR_PLATFORM to be set to the target. If
# CMAKE_GENERATOR_PLATFORM is set, compare it with
# CMAKE_HOST_SYSTEM_PROCESSOR and, if they're not equal, set
# CMAKE_CROSSCOMPILING to TRUE.
#
if (CMAKE_GENERATOR_PLATFORM AND
NOT CMAKE_GENERATOR_PLATFORM STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
set(CMAKE_CROSSCOMPILING TRUE)
endif()

###################################################################
# Detect available platform features
###################################################################
Expand Down