CMakeDetermineSystem: Clarify comment when CMAKE_SYSTEM_NAME is already set

This commit is contained in:
Brad King
2024-01-30 12:13:38 -05:00
parent 84dd192326
commit 0b181cec03

View File

@@ -177,11 +177,9 @@ if(CMAKE_TOOLCHAIN_FILE)
endif()
endif()
# if CMAKE_SYSTEM_NAME is here already set, either it comes from a toolchain file
# or it was set via -DCMAKE_SYSTEM_NAME=...
# if that's the case, assume we are crosscompiling
if(CMAKE_SYSTEM_NAME)
# CMAKE_SYSTEM_NAME was set by a toolchain file or on the command line.
# Assume it set CMAKE_SYSTEM_VERSION and CMAKE_SYSTEM_PROCESSOR too.
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING TRUE)
endif()
@@ -193,6 +191,7 @@ elseif(CMAKE_VS_WINCE_VERSION)
set(CMAKE_CROSSCOMPILING TRUE)
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
else()
# Build for the host platform and architecture by default.
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
if(NOT DEFINED CMAKE_SYSTEM_VERSION)
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")