summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Maushart <FloriansGit@online.ms>2017-05-30 21:33:18 +0200
committerBrad King <brad.king@kitware.com>2017-06-05 13:51:30 -0400
commite7869e80ce6ffc538f559aa12dd54bb90ea9945e (patch)
treef6d1fc90ea22a76b4e30297d4ee1752c0b4eaa2f
parentc095e90f3af78fb3421c80b725ebc6ad9ec85999 (diff)
downloadcmake-e7869e80ce6ffc538f559aa12dd54bb90ea9945e.tar.gz
cmake_host_system_information: Add more keywords
Extend the `cmake_host_system_information()` command to add processor identification keywords.
-rw-r--r--Auxiliary/vim/syntax/cmake.vim2
-rw-r--r--Help/command/cmake_host_system_information.rst41
-rw-r--r--Help/release/dev/cmake_host_system_information-extend.rst6
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx49
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in19
5 files changed, 106 insertions, 11 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index a191c18726..451760344d 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -78,7 +78,7 @@ syn keyword cmakeKWbuild_name contained
\ CMAKE_CXX_COMPILER
syn keyword cmakeKWcmake_host_system_information contained
- \ AVAILABLE_PHYSICAL_MEMORY AVAILABLE_VIRTUAL_MEMORY FQDN HOSTNAME NUMBER_OF_LOGICAL_CORES NUMBER_OF_PHYSICAL_CORES QUERY RESULT TOTAL_PHYSICAL_MEMORY TOTAL_VIRTUAL_MEMORY
+ \ AVAILABLE_PHYSICAL_MEMORY AVAILABLE_VIRTUAL_MEMORY FQDN HOSTNAME NUMBER_OF_LOGICAL_CORES NUMBER_OF_PHYSICAL_CORES QUERY RESULT TOTAL_PHYSICAL_MEMORY TOTAL_VIRTUAL_MEMORY IS_64BIT HAS_FPU HAS_MMX HAS_MMX_PLUS HAS_SSE HAS_SSE2 HAS_SSE_FP HAS_SSE_MMX HAS_AMD_3DNOW HAS_AMD_3DNOW_PLUS HAS_IA64 HAS_SERIAL_NUMBER PROCESSOR_SERIAL_NUMBER PROCESSOR_NAME OS_NAME OS_RELEASE OS_VERSION OS_PLATFORM
syn keyword cmakeKWcmake_minimum_required contained
\ FATAL_ERROR VERSION
diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst
index 9402d57e97..7199874ce9 100644
--- a/Help/command/cmake_host_system_information.rst
+++ b/Help/command/cmake_host_system_information.rst
@@ -13,13 +13,34 @@ queried. The list of queried values is stored in ``<variable>``.
``<key>`` can be one of the following values:
-::
-
- NUMBER_OF_LOGICAL_CORES = Number of logical cores.
- NUMBER_OF_PHYSICAL_CORES = Number of physical cores.
- HOSTNAME = Hostname.
- FQDN = Fully qualified domain name.
- TOTAL_VIRTUAL_MEMORY = Total virtual memory in megabytes.
- AVAILABLE_VIRTUAL_MEMORY = Available virtual memory in megabytes.
- TOTAL_PHYSICAL_MEMORY = Total physical memory in megabytes.
- AVAILABLE_PHYSICAL_MEMORY = Available physical memory in megabytes.
+============================= ================================================
+Key Description
+============================= ================================================
+``NUMBER_OF_LOGICAL_CORES`` Number of logical cores
+``NUMBER_OF_PHYSICAL_CORES`` Number of physical cores
+``HOSTNAME`` Hostname
+``FQDN`` Fully qualified domain name
+``TOTAL_VIRTUAL_MEMORY`` Total virtual memory in megabytes
+``AVAILABLE_VIRTUAL_MEMORY`` Available virtual memory in megabytes
+``TOTAL_PHYSICAL_MEMORY`` Total physical memory in megabytes
+``AVAILABLE_PHYSICAL_MEMORY`` Available physical memory in megabytes
+``IS_64BIT`` One if processor is 64Bit
+``HAS_FPU`` One if processor has floating point unit
+``HAS_MMX`` One if processor supports MMX instructions
+``HAS_MMX_PLUS`` One if porcessor supports Ext. MMX instructions
+``HAS_SSE`` One if porcessor supports SSE instructions
+``HAS_SSE2`` One if porcessor supports SSE2 instructions
+``HAS_SSE_FP`` One if porcessor supports SSE FP instructions
+``HAS_SSE_MMX`` One if porcessor supports SSE MMX instructions
+``HAS_AMD_3DNOW`` One if porcessor supports 3DNow instructions
+``HAS_AMD_3DNOW_PLUS`` One if porcessor supports 3DNow+ instructions
+``HAS_IA64`` One if IA64 processor emulating x86
+``HAS_SERIAL_NUMBER`` One if processor has serial number
+``PROCESSOR_SERIAL_NUMBER`` Processor serial number
+``PROCESSOR_NAME`` Human readable processor name
+``PROCESSOR_DESCRIPTION`` Human readable full processor description
+``OS_NAME`` See :variable:`CMAKE_HOST_SYSTEM_NAME`
+``OS_RELEASE`` The OS sub-type e.g. on Windows ``Professional``
+``OS_VERSION`` The OS build ID
+``OS_PLATFORM`` See :variable:`CMAKE_HOST_SYSTEM_PROCESSOR`
+============================= ================================================
diff --git a/Help/release/dev/cmake_host_system_information-extend.rst b/Help/release/dev/cmake_host_system_information-extend.rst
new file mode 100644
index 0000000000..d1c882d96c
--- /dev/null
+++ b/Help/release/dev/cmake_host_system_information-extend.rst
@@ -0,0 +1,6 @@
+cmake_host_system_information-extend
+------------------------------------
+
+* The :command:`cmake_host_system_information` command learned more keys
+ to get information about the processor capabilities and the host OS
+ version.
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 4475c5a52e..5106f522df 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -76,6 +76,55 @@ bool cmCMakeHostSystemInformationCommand::GetValue(
value = this->ValueToString(info.GetTotalPhysicalMemory());
} else if (key == "AVAILABLE_PHYSICAL_MEMORY") {
value = this->ValueToString(info.GetAvailablePhysicalMemory());
+ } else if (key == "IS_64BIT") {
+ value = this->ValueToString(info.Is64Bits());
+ } else if (key == "HAS_FPU") {
+ value = this->ValueToString(
+ info.DoesCPUSupportFeature(cmsys::SystemInformation::CPU_FEATURE_FPU));
+ } else if (key == "HAS_MMX") {
+ value = this->ValueToString(
+ info.DoesCPUSupportFeature(cmsys::SystemInformation::CPU_FEATURE_MMX));
+ } else if (key == "HAS_MMX_PLUS") {
+ value = this->ValueToString(info.DoesCPUSupportFeature(
+ cmsys::SystemInformation::CPU_FEATURE_MMX_PLUS));
+ } else if (key == "HAS_SSE") {
+ value = this->ValueToString(
+ info.DoesCPUSupportFeature(cmsys::SystemInformation::CPU_FEATURE_SSE));
+ } else if (key == "HAS_SSE2") {
+ value = this->ValueToString(
+ info.DoesCPUSupportFeature(cmsys::SystemInformation::CPU_FEATURE_SSE2));
+ } else if (key == "HAS_SSE_FP") {
+ value = this->ValueToString(info.DoesCPUSupportFeature(
+ cmsys::SystemInformation::CPU_FEATURE_SSE_FP));
+ } else if (key == "HAS_SSE_MMX") {
+ value = this->ValueToString(info.DoesCPUSupportFeature(
+ cmsys::SystemInformation::CPU_FEATURE_SSE_MMX));
+ } else if (key == "HAS_AMD_3DNOW") {
+ value = this->ValueToString(info.DoesCPUSupportFeature(
+ cmsys::SystemInformation::CPU_FEATURE_AMD_3DNOW));
+ } else if (key == "HAS_AMD_3DNOW_PLUS") {
+ value = this->ValueToString(info.DoesCPUSupportFeature(
+ cmsys::SystemInformation::CPU_FEATURE_AMD_3DNOW_PLUS));
+ } else if (key == "HAS_IA64") {
+ value = this->ValueToString(
+ info.DoesCPUSupportFeature(cmsys::SystemInformation::CPU_FEATURE_IA64));
+ } else if (key == "HAS_SERIAL_NUMBER") {
+ value = this->ValueToString(info.DoesCPUSupportFeature(
+ cmsys::SystemInformation::CPU_FEATURE_SERIALNUMBER));
+ } else if (key == "PROCESSOR_NAME") {
+ value = this->ValueToString(info.GetExtendedProcessorName());
+ } else if (key == "PROCESSOR_DESCRIPTION") {
+ value = info.GetCPUDescription();
+ } else if (key == "PROCESSOR_SERIAL_NUMBER") {
+ value = this->ValueToString(info.GetProcessorSerialNumber());
+ } else if (key == "OS_NAME") {
+ value = this->ValueToString(info.GetOSName());
+ } else if (key == "OS_RELEASE") {
+ value = this->ValueToString(info.GetOSRelease());
+ } else if (key == "OS_VERSION") {
+ value = this->ValueToString(info.GetOSVersion());
+ } else if (key == "OS_PLATFORM") {
+ value = this->ValueToString(info.GetOSPlatform());
#ifdef HAVE_VS_SETUP_HELPER
} else if (key == "VS_15_DIR") {
cmVSSetupAPIHelper vsSetupAPIHelper;
diff --git a/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in b/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in
index 3294a2f0dc..a3c2b055ac 100644
--- a/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in
+++ b/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in
@@ -22,6 +22,25 @@ try_and_print(TOTAL_VIRTUAL_MEMORY)
try_and_print(AVAILABLE_VIRTUAL_MEMORY)
try_and_print(TOTAL_PHYSICAL_MEMORY)
try_and_print(AVAILABLE_PHYSICAL_MEMORY)
+try_and_print(IS_64BIT)
+try_and_print(HAS_FPU)
+try_and_print(HAS_MMX)
+try_and_print(HAS_MMX_PLUS)
+try_and_print(HAS_SSE)
+try_and_print(HAS_SSE2)
+try_and_print(HAS_SSE_FP)
+try_and_print(HAS_SSE_MMX)
+try_and_print(HAS_AMD_3DNOW)
+try_and_print(HAS_AMD_3DNOW_PLUS)
+try_and_print(HAS_IA64)
+try_and_print(HAS_SERIAL_NUMBER)
+try_and_print(PROCESSOR_SERIAL_NUMBER)
+try_and_print(PROCESSOR_NAME)
+try_and_print(PROCESSOR_DESCRIPTION)
+try_and_print(OS_NAME)
+try_and_print(OS_RELEASE)
+try_and_print(OS_VERSION)
+try_and_print(OS_PLATFORM)
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")