summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-02-01 13:15:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-02-01 13:15:59 (GMT)
commitb1a5c0813928cce25ffd85c1d8173fb122fbe42c (patch)
tree4feb8ab351b60493af21121755589ee77d8c53ca /Modules
parent2ff91f5fc4330564e11726faaa551c15ac178ae3 (diff)
parent79ce5ef4e0fe982f663ca4e4a4870ce8007ecba6 (diff)
downloadCMake-b1a5c0813928cce25ffd85c1d8173fb122fbe42c.zip
CMake-b1a5c0813928cce25ffd85c1d8173fb122fbe42c.tar.gz
CMake-b1a5c0813928cce25ffd85c1d8173fb122fbe42c.tar.bz2
Merge topic 'cross-compiling-init'
79ce5ef4e0 CMakeDetermineSystem: Simplify cross-compiling logging decision 0b181cec03 CMakeDetermineSystem: Clarify comment when CMAKE_SYSTEM_NAME is already set Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9206
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineSystem.cmake12
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index fff4e9d..1ccde43 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -177,22 +177,19 @@ 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()
- set(PRESET_CMAKE_SYSTEM_NAME TRUE)
elseif(CMAKE_VS_WINCE_VERSION)
set(CMAKE_SYSTEM_NAME "WindowsCE")
set(CMAKE_SYSTEM_VERSION "${CMAKE_VS_WINCE_VERSION}")
set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
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}")
@@ -206,7 +203,6 @@ else()
)
endif()
set(CMAKE_CROSSCOMPILING FALSE)
- set(PRESET_CMAKE_SYSTEM_NAME FALSE)
endif()
include(Platform/${CMAKE_SYSTEM_NAME}-Determine OPTIONAL)
@@ -224,7 +220,7 @@ endif()
# in this case there is no CMAKE_BINARY_DIR
if(CMAKE_BINARY_DIR)
# write entry to the log file
- if(PRESET_CMAKE_SYSTEM_NAME)
+ if(CMAKE_CROSSCOMPILING)
message(CONFIGURE_LOG
"The target system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n"
"The host system is: ${CMAKE_HOST_SYSTEM_NAME} - ${CMAKE_HOST_SYSTEM_VERSION} - ${CMAKE_HOST_SYSTEM_PROCESSOR}\n"