summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWil Stark <wil_stark@keysight.com>2018-12-12 18:28:32 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-10 17:49:51 (GMT)
commita4332cac4bd178fd1b771154413565ae0b0ce61f (patch)
tree248badb3f564591feea1bb420d6140a52ca9f17f
parent6092a770f66bff959749170141d44188f4b6f3f1 (diff)
downloadCMake-a4332cac4bd178fd1b771154413565ae0b0ce61f.zip
CMake-a4332cac4bd178fd1b771154413565ae0b0ce61f.tar.gz
CMake-a4332cac4bd178fd1b771154413565ae0b0ce61f.tar.bz2
Tests: Detect VS and SDK availability early
-rw-r--r--Tests/CMakeLists.txt88
1 files changed, 44 insertions, 44 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2a8d3e6..3e58471 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -163,6 +163,50 @@ if(BUILD_TESTING)
set(CPACK_BINARY_NUGET OFF)
endif()
+ if(WIN32)
+ # Macro to search for available Windows CE SDKs in the windows Registry
+ macro(select_wince_sdk selected_reg selected_sdk)
+ if(CMAKE_HOST_WIN32)
+ execute_process(COMMAND reg QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs"
+ OUTPUT_VARIABLE sdk_reg
+ ERROR_VARIABLE my_err)
+ string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}")
+ list(LENGTH sdk_list sdk_list_len)
+ if (${sdk_list_len} GREATER 1)
+ list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above
+ string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name
+ endif()
+ # Build a key to be used by get_filename_component that is pointing to the SDK directory
+ set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]")
+
+ # Set return values
+ set(${selected_reg} ${_reg})
+ set(${selected_sdk} ${_sdk})
+ endif(CMAKE_HOST_WIN32)
+ endmacro(select_wince_sdk)
+
+ set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]")
+ set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]")
+ set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]")
+ set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]")
+ set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]")
+ set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]")
+ set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]")
+ set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]")
+ set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]")
+ select_wince_sdk(reg_wince wince_sdk)
+ set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]")
+ set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]")
+ foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm)
+ get_filename_component(r "${reg_${reg}}" ABSOLUTE)
+ if(IS_DIRECTORY "${r}" AND NOT "${r}" STREQUAL "/registry")
+ set(${reg} 1)
+ else()
+ set(${reg} 0)
+ endif()
+ endforeach()
+ endif()
+
#---------------------------------------------------------------------------
# Add tests below here.
@@ -2125,50 +2169,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif()
endif()
- if(WIN32)
- # Macro to search for available Windows CE SDKs in the windows Registry
- macro(select_wince_sdk selected_reg selected_sdk)
- if(CMAKE_HOST_WIN32)
- execute_process(COMMAND reg QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs"
- OUTPUT_VARIABLE sdk_reg
- ERROR_VARIABLE my_err)
- string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}")
- list(LENGTH sdk_list sdk_list_len)
- if (${sdk_list_len} GREATER 1)
- list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above
- string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name
- endif()
- # Build a key to be used by get_filename_component that is pointing to the SDK directory
- set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]")
-
- # Set return values
- set(${selected_reg} ${_reg})
- set(${selected_sdk} ${_sdk})
- endif(CMAKE_HOST_WIN32)
- endmacro(select_wince_sdk)
-
- set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]")
- set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]")
- set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]")
- set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]")
- set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]")
- set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]")
- set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]")
- set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]")
- set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]")
- select_wince_sdk(reg_wince wince_sdk)
- set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]")
- set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]")
- foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm)
- get_filename_component(r "${reg_${reg}}" ABSOLUTE)
- if(IS_DIRECTORY "${r}" AND NOT "${r}" STREQUAL "/registry")
- set(${reg} 1)
- else()
- set(${reg} 0)
- endif()
- endforeach()
- endif()
-
get_filename_component(ntver "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion;CurrentVersion]" NAME)
if(WIN32 AND ntver VERSION_GREATER 6.1) # Windows >= 8.0
macro(add_test_VSWinStorePhone name generator systemName systemVersion architecture)