summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-04-28 12:23:49 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2022-05-01 10:57:24 (GMT)
commit0c33f12a39d88649f553d517392bb55f3007ab52 (patch)
tree0b874d95b4fc3a47f3243bd7cdfdde67e8a07e81 /Tests
parentbbb51444a26970acb1fe6258ed92be368f4ef670 (diff)
downloadCMake-0c33f12a39d88649f553d517392bb55f3007ab52.zip
CMake-0c33f12a39d88649f553d517392bb55f3007ab52.tar.gz
CMake-0c33f12a39d88649f553d517392bb55f3007ab52.tar.bz2
cmake_host_system_information(WINDOWS_REGISTRY) updates
* add a cross-reference in 'get_filename_component()' documentation * rework tests for better 32bit systems support
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/cmake_host_system_information/Registry_Query.cmake368
-rw-r--r--Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake20
-rw-r--r--Tests/RunCMake/cmake_host_system_information/registry_host32bit.regbin0 -> 1574 bytes
-rw-r--r--Tests/RunCMake/cmake_host_system_information/registry_host64bit.reg (renamed from Tests/RunCMake/cmake_host_system_information/registry_data.reg)bin2322 -> 2322 bytes
4 files changed, 252 insertions, 136 deletions
diff --git a/Tests/RunCMake/cmake_host_system_information/Registry_Query.cmake b/Tests/RunCMake/cmake_host_system_information/Registry_Query.cmake
index 9f9fb14..97a4ecc 100644
--- a/Tests/RunCMake/cmake_host_system_information/Registry_Query.cmake
+++ b/Tests/RunCMake/cmake_host_system_information/Registry_Query.cmake
@@ -1,12 +1,4 @@
-# check Windows architecture
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status)
-if (status STREQUAL "")
- set(HOST_64BIT TRUE)
-else()
- set(HOST_64BIT FALSE)
-endif()
-
# helper function for test validation
function(CHECK key result status expression)
if(status STREQUAL "")
@@ -25,33 +17,51 @@ set(KEY "HKCU/Software/Classes/CLSID/CMake-Tests/chsi-registry")
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" ERROR_VARIABLE status)
check("${KEY}" "${result}" "${status}"
- "(HOST_64BIT AND result STREQUAL \"default 64bit\")
- OR (NOT HOST_64BIT AND result STREQUAL \"default 32bit\")")
+ "result STREQUAL \"default ${ARCH}\"")
# query value using special name should be identical to default value
cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE "(default)" ERROR_VARIABLE status)
check("${KEY}{(default)}" "${result2}" "${status}" "result2 STREQUAL result")
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW HOST ERROR_VARIABLE status)
check("${KEY}" "${result}" "${status}"
- "(HOST_64BIT AND result STREQUAL \"default 64bit\")
- OR (NOT HOST_64BIT AND result STREQUAL \"default 32bit\")")
+ "result STREQUAL \"default ${ARCH}\"")
# VIEW TARGET should have same value as VIEW HOST
cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VIEW TARGET ERROR_VARIABLE status)
check("${KEY}" "${result2}" "${status}" "result2 STREQUAL result")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64 ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"")
+if (ARCH STREQUAL "64bit")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64 ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32 ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"")
+
+ # reg 64bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64_32 ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32 ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"")
+ # reg 32bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32_64 ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"")
-# reg 64bit is read first
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64_32 ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"")
+else() #32bit
-# reg 32bit is read first
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32_64 ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64 ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"\"")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32 ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"")
+
+ # reg 64bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 64_32 ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"")
+
+ # reg 32bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VIEW 32_64 ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"")
+
+endif()
# HKCU/Software/CMake-Tests/chsi-registry: Query named value
@@ -60,37 +70,58 @@ set(KEY "HKCU/Software/Classes/CLSID/CMake-Tests/chsi-registry")
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
ERROR_VARIABLE status)
check("${KEY}{BYTE_SIZE}" "${result}" "${status}"
- "(HOST_64BIT AND result STREQUAL \"64bit\")
- OR (NOT HOST_64BIT AND result STREQUAL \"32bit\")")
+ "result STREQUAL \"${ARCH}\"")
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
VIEW HOST ERROR_VARIABLE status)
check("${KEY}{BYTE_SIZE}" "${result}" "${status}"
- "(HOST_64BIT AND result STREQUAL \"64bit\")
- OR (NOT HOST_64BIT AND result STREQUAL \"32bit\")")
+ "result STREQUAL \"${ARCH}\"")
# VIEW TARGET should have same value as VIEW HOST
cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
VIEW TARGET ERROR_VARIABLE status)
check("${KEY}{BYTE_SIZE}" "${result2}" "${status}" "result2 STREQUAL result")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
- VIEW 64 ERROR_VARIABLE status)
-check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"64bit\"")
+if (ARCH STREQUAL "64bit")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
- VIEW 32 ERROR_VARIABLE status)
-check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW 64 ERROR_VARIABLE status)
+ check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"64bit\"")
-# reg 64bit is read first
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
- VIEW 64_32 ERROR_VARIABLE status)
-check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"64bit\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW 32 ERROR_VARIABLE status)
+ check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"")
-# reg 32bit is read first
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
- VIEW 32_64 ERROR_VARIABLE status)
-check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"")
+ # reg 64bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW 64_32 ERROR_VARIABLE status)
+ check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"64bit\"")
+
+ # reg 32bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW 32_64 ERROR_VARIABLE status)
+ check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"")
+
+else() # 32bit
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW 64 ERROR_VARIABLE status)
+ check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW 32 ERROR_VARIABLE status)
+ check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"")
+
+ # reg 64bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW 64_32 ERROR_VARIABLE status)
+ check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"")
+
+ # reg 32bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW 32_64 ERROR_VARIABLE status)
+ check("${KEY}{BYTE_SIZE}" "${result}" "${status}" "result STREQUAL \"32bit\"")
+
+endif()
# HKCU/Software/CMake-Tests/chsi-registry: check retrieval of various types
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE VALUE_SZ ERROR_VARIABLE status)
@@ -114,119 +145,192 @@ check("${KEY}{VALUE_QWORD}" "${result}" "${status}" "result EQUAL \"513\"")
# HKCU/Software/CMake-Tests/chsi-registry: check retrieval of value names
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- ERROR_VARIABLE status)
-check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
-# VIEW BOTH should have same result as default view
-cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- VIEW BOTH ERROR_VARIABLE status)
-check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+if (ARCH STREQUAL "64bit")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+ # VIEW BOTH should have same result as default view
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW BOTH ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW HOST ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}"
+ "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+ # VIEW TARGET should have same result as VIEW HOST
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW 64 ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}"
+ "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW 32 ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\"")
+
+ # reg 64bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW 64_32 ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}"
+ "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+
+ # reg 32bit is read first. Result is the same as with view 64_32
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW 32_64 ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- VIEW HOST ERROR_VARIABLE status)
-check("${KEY}[VALUE_NAMES]" "${result}" "${status}"
- "(HOST_64BIT AND result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\")
- OR (NOT HOST_64BIT AND result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\")")
-# VIEW TARGET should have same result as VIEW HOST
-cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}[VALUE_NAMES]" "${result2}" "${status}"
- "(HOST_64BIT AND result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\")
- OR (NOT HOST_64BIT AND result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\")")
+else()
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- VIEW 64 ERROR_VARIABLE status)
-check("${KEY}[VALUE_NAMES]" "${result}" "${status}"
- "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+ # VIEW BOTH should have same result as default view
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW BOTH ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result STREQUAL result2")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW HOST ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}"
+ "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ")
+ # VIEW TARGET should have same result as VIEW HOST
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW 64 ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"\"")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW 32 ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+
+ # reg 64bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW 64_32 ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result}" "${status}"
+ "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+
+ # reg 32bit is read first. Result is the same as with view 64_32
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW 32_64 ERROR_VARIABLE status)
+ check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- VIEW 32 ERROR_VARIABLE status)
-check("${KEY}[VALUE_NAMES]" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\"")
+endif()
-# reg 64bit is read first
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- VIEW 64_32 ERROR_VARIABLE status)
-check("${KEY}[VALUE_NAMES]" "${result}" "${status}"
- "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE2_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
-# reg 32bit is read first. Result is the same as with view 64_32
-cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- VIEW 32_64 ERROR_VARIABLE status)
-check("${KEY}[VALUE_NAMES]" "${result2}" "${status}" "result2 STREQUAL result")
+# HKCU/Software/CMake-Tests/chsi-registry: check retrieval of sub keys
+if (ARCH STREQUAL "64bit")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2;subkey3\"")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW HOST ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"")
+ # VIEW TARGET should have same result as VIEW HOST
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result2 STREQUAL result")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW 64 ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW 32 ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey3\"")
+
+ # reg 64bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW 64_32 ERROR_VARIABLE status)
+ check("${KEY}[SUBLEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2;subkey3\"")
+
+ # reg 32bit is read first. Result is the same as with view 64_32
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW 32_64 ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result2}" "${status}" "result2 STREQUAL result")
+else()
-# HKCU/Software/CMake-Tests/chsi-registry: check retrieval of sub keys
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
- ERROR_VARIABLE status)
-check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2;subkey3\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
- VIEW HOST ERROR_VARIABLE status)
-check("${KEY}[SUBKEYS]" "${result}" "${status}"
- "(HOST_64BIT AND result STREQUAL \"subkey1;subkey2\")
- OR (NOT HOST_64BIT AND result STREQUAL \"subkey1;subkey3\")")
-# VIEW TARGET should have same result as VIEW HOST
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}[SUBKEYS]" "${result}" "${status}"
- "(HOST_64BIT AND result STREQUAL \"subkey1;subkey2\")
- OR (NOT HOST_64BIT AND result STREQUAL \"subkey1;subkey3\")")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW HOST ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"")
+ # VIEW TARGET should have same result as VIEW HOST
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result2 STREQUAL result")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
- VIEW 64 ERROR_VARIABLE status)
-check("${KEY}[SUBKEYS]" "${result}" "${status}"
- "result STREQUAL \"subkey1;subkey2\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW 64 ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"\"")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
- VIEW 32 ERROR_VARIABLE status)
-check("${KEY}[SUBKEYS]" "${result}" "${status}"
- "result STREQUAL \"subkey1;subkey3\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW 32 ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"")
-# reg 64bit is read first
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
- VIEW 64_32 ERROR_VARIABLE status)
-check("${KEY}[SUBLEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2;subkey3\"")
+ # reg 64bit is read first
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW 64_32 ERROR_VARIABLE status)
+ check("${KEY}[SUBLEYS]" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"")
-# reg 32bit is read first. Result is the same as with view 64_32
-cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
- VIEW 32_64 ERROR_VARIABLE status)
-check("${KEY}[SUBKEYS]" "${result2}" "${status}" "result2 STREQUAL result")
+ # reg 32bit is read first. Result is the same as with view 64_32
+ cmake_host_system_information(RESULT result2 QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW 32_64 ERROR_VARIABLE status)
+ check("${KEY}[SUBKEYS]" "${result2}" "${status}" "result2 STREQUAL result")
+endif()
-# Check influence of variable CMAKE_SIZEOF_VOID_P
-set(CMAKE_SIZEOF_VOID_P 8)
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}"
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"")
+if (ARCH STREQUAL "64bit")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"64bit\"")
+ # Check influence of variable CMAKE_SIZEOF_VOID_P
+ set(CMAKE_SIZEOF_VOID_P 8)
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}"
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 64bit\"")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"64bit\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_MULTI_SZ;VALUE_DWORD;VALUE_EXPAND_SZ;VALUE_MULTI_SZ;VALUE_QWORD;VALUE_SZ\"")
-set(CMAKE_SIZEOF_VOID_P 4)
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"subkey1;subkey2\"")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}"
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"32bit\"")
+ set(CMAKE_SIZEOF_VOID_P 4)
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}"
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"default 32bit\"")
-cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
- VIEW TARGET ERROR_VARIABLE status)
-check("${KEY}" "${result}" "${status}" "result STREQUAL \"subkey1;subkey3\"")
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE BYTE_SIZE
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"32bit\"")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" VALUE_NAMES
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"(default);BYTE_SIZE;VALUE2_SZ\"")
+
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "${KEY}" SUBKEYS
+ VIEW TARGET ERROR_VARIABLE status)
+ check("${KEY}" "${result}" "${status}" "result STREQUAL \"subkey1;subkey3\"")
+
+endif()
diff --git a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
index d857bee..9122470 100644
--- a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
@@ -36,12 +36,24 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
# Tests using the Windows registry
find_program(REG NAMES "reg.exe" NO_CACHE)
if (REG)
+ ## check host architecture
+ cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status)
+ if (status STREQUAL "")
+ set(ARCH "64bit")
+ else()
+ set(ARCH "32bit")
+ endif()
+
# crete some entries in the registry
- cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_data.reg" TO_NATIVE_PATH_LIST registry_data)
+ cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_host${ARCH}.reg" TO_NATIVE_PATH_LIST registry_data)
execute_process(COMMAND "${REG}" import "${registry_data}" OUTPUT_QUIET ERROR_QUIET)
- run_cmake(Registry_Query)
+
+ run_cmake_with_options(Registry_Query -DARCH=${ARCH})
+
# clean-up registry
- execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests" /f OUTPUT_QUIET ERROR_QUIET)
- execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests" /f OUTPUT_QUIET ERROR_QUIET)
+ execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests\\chsi-registry" /f OUTPUT_QUIET ERROR_QUIET)
+ if (ARCH STREQUAL "64bit")
+ execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests\\chsi-registry" /f OUTPUT_QUIET ERROR_QUIET)
+ endif()
endif()
endif()
diff --git a/Tests/RunCMake/cmake_host_system_information/registry_host32bit.reg b/Tests/RunCMake/cmake_host_system_information/registry_host32bit.reg
new file mode 100644
index 0000000..2bbd6a2
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/registry_host32bit.reg
Binary files differ
diff --git a/Tests/RunCMake/cmake_host_system_information/registry_data.reg b/Tests/RunCMake/cmake_host_system_information/registry_host64bit.reg
index 8596648..8596648 100644
--- a/Tests/RunCMake/cmake_host_system_information/registry_data.reg
+++ b/Tests/RunCMake/cmake_host_system_information/registry_host64bit.reg
Binary files differ