summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2023-03-24 08:59:23 (GMT)
committerBrad King <brad.king@kitware.com>2023-03-24 15:57:01 (GMT)
commit4d23636694f88c5a34926bae1f26d90a229d6773 (patch)
tree010c25890751bc29df782805a5ae127299f61e79 /Modules
parentc4c4ca0e87a900bf077b05b79b9a2198ec7493d6 (diff)
downloadCMake-4d23636694f88c5a34926bae1f26d90a229d6773.zip
CMake-4d23636694f88c5a34926bae1f26d90a229d6773.tar.gz
CMake-4d23636694f88c5a34926bae1f26d90a229d6773.tar.bz2
Warn if CMAKE_CROSSCOMPILING is true without CMAKE_SYSTEM_NAME set
Also clarify the `CMAKE_CROSSCOMPILING` documentation to state that CMake sets the variable automatically.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineSystem.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index d4dcc62..386be73 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -176,6 +176,13 @@ else()
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
endif()
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
+ if(CMAKE_CROSSCOMPILING)
+ message(AUTHOR_WARNING
+ "CMAKE_CROSSCOMPILING has been set by the project, toolchain file, or user. "
+ "CMake is resetting it to false because CMAKE_SYSTEM_NAME was not set. "
+ "To indicate cross compilation, only CMAKE_SYSTEM_NAME needs to be set."
+ )
+ endif()
set(CMAKE_CROSSCOMPILING FALSE)
set(PRESET_CMAKE_SYSTEM_NAME FALSE)
endif()