summaryrefslogtreecommitdiffstats
path: root/Modules/FindJNI.cmake
diff options
context:
space:
mode:
authorscivision <scivision@users.noreply.github.com>2023-09-20 04:15:35 (GMT)
committerscivision <scivision@users.noreply.github.com>2023-09-20 18:22:37 (GMT)
commit88411fd62970997d97021f873355beabe47f80a7 (patch)
tree4dc7b830cf0e992af864604460f7321824c80bd7 /Modules/FindJNI.cmake
parentb56d4e041a62985b1e9c757a1b12c6cf3f2f4ae4 (diff)
downloadCMake-88411fd62970997d97021f873355beabe47f80a7.zip
CMake-88411fd62970997d97021f873355beabe47f80a7.tar.gz
CMake-88411fd62970997d97021f873355beabe47f80a7.tar.bz2
FindJNI: use cmake_host_system_info to query registry
Diffstat (limited to 'Modules/FindJNI.cmake')
-rw-r--r--Modules/FindJNI.cmake13
1 files changed, 6 insertions, 7 deletions
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index e7050a3..d2b0fab 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -235,13 +235,12 @@ endif()
if (WIN32)
set (_JNI_HINTS)
macro (_JNI_GET_INSTALLED_VERSIONS _KIND)
- execute_process(COMMAND REG QUERY "HKLM\\SOFTWARE\\JavaSoft\\${_KIND}"
- RESULT_VARIABLE _JAVA_RESULT
- OUTPUT_VARIABLE _JAVA_VERSIONS
- ERROR_QUIET)
- if (NOT _JAVA_RESULT)
- string (REGEX MATCHALL "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\JavaSoft\\\\${_KIND}\\\\[0-9._]+" _JNI_VERSIONS "${_JAVA_VERSIONS}")
- string (REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\JavaSoft\\\\${_KIND}\\\\([0-9._]+)" "\\1" _JNI_VERSIONS "${_JNI_VERSIONS}")
+ cmake_host_system_information(RESULT _JNI_VERSIONS
+ QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/JavaSoft/${_KIND}"
+ SUBKEYS)
+ if (_JNI_VERSIONS)
+ string (REGEX MATCHALL "[0-9._]+" _JNI_VERSIONS "${_JNI_VERSIONS}")
+ string (REGEX REPLACE "([0-9._]+)" "\\1" _JNI_VERSIONS "${_JNI_VERSIONS}")
if (_JNI_VERSIONS)
# sort versions. Most recent first
list (SORT _JNI_VERSIONS COMPARE NATURAL ORDER DESCENDING)