summaryrefslogtreecommitdiffstats
path: root/Source/cmStateSnapshot.cxx
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2016-12-26 15:08:51 (GMT)
committerGregor Jasny <gjasny@googlemail.com>2017-02-19 18:27:34 (GMT)
commit0bbd993f618e4ded1d949e64ba778dfab3106262 (patch)
tree1305baa8b9535ecb03397a7f04b873ae0ea84774 /Source/cmStateSnapshot.cxx
parent96b6afdc4289a3f04983ee5f5af82c83b422c583 (diff)
downloadCMake-0bbd993f618e4ded1d949e64ba778dfab3106262.zip
CMake-0bbd993f618e4ded1d949e64ba778dfab3106262.tar.gz
CMake-0bbd993f618e4ded1d949e64ba778dfab3106262.tar.bz2
Make CMAKE_HOST_SYSTEM_NAME available in scripting context
Diffstat (limited to 'Source/cmStateSnapshot.cxx')
-rw-r--r--Source/cmStateSnapshot.cxx10
1 files changed, 10 insertions, 0 deletions
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;