summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeDetermineSystem.cmake2
-rw-r--r--Source/cmStateSnapshot.cxx10
-rw-r--r--Tests/CMakeTests/ToolchainTest.cmake.in1
3 files changed, 10 insertions, 3 deletions
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index 8675553..fb1a9ed 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -35,7 +35,6 @@
if(CMAKE_HOST_UNIX)
find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
if(CMAKE_UNAME)
- exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME)
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin|^GNU$")
exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
@@ -67,7 +66,6 @@ if(CMAKE_HOST_UNIX)
endif()
else()
if(CMAKE_HOST_WIN32)
- set (CMAKE_HOST_SYSTEM_NAME "Windows")
if (DEFINED ENV{PROCESSOR_ARCHITEW6432})
set (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}")
else()
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index c6288a5..80e494b 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -18,6 +18,10 @@
#include "cmVersion.h"
#include "cmake.h"
+#if !defined(_WIN32)
+#include <sys/utsname.h>
+#endif
+
#if defined(__CYGWIN__)
#include "cmSystemTools.h"
#endif
@@ -298,9 +302,15 @@ void cmStateSnapshot::SetDefaultDefinitions()
#if defined(_WIN32)
this->SetDefinition("WIN32", "1");
this->SetDefinition("CMAKE_HOST_WIN32", "1");
+ this->SetDefinition("CMAKE_HOST_SYSTEM_NAME", "Windows");
#else
this->SetDefinition("UNIX", "1");
this->SetDefinition("CMAKE_HOST_UNIX", "1");
+
+ struct utsname uts_name;
+ if (uname(&uts_name) == 0) {
+ this->SetDefinition("CMAKE_HOST_SYSTEM_NAME", uts_name.sysname);
+ }
#endif
#if defined(__CYGWIN__)
std::string legacy;
diff --git a/Tests/CMakeTests/ToolchainTest.cmake.in b/Tests/CMakeTests/ToolchainTest.cmake.in
index 96e7196..ea44f42 100644
--- a/Tests/CMakeTests/ToolchainTest.cmake.in
+++ b/Tests/CMakeTests/ToolchainTest.cmake.in
@@ -48,7 +48,6 @@ set(CMAKE_SYSTEM_NAME)
set(CMAKE_SYSTEM_VERSION)
set(CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_HOST_SYSTEM)
-set(CMAKE_HOST_SYSTEM_NAME)
set(CMAKE_HOST_SYSTEM_VERSION)
set(CMAKE_HOST_SYSTEM_PROCESSOR)