diff options
author | scivision <scivision@users.noreply.github.com> | 2023-09-20 04:07:14 (GMT) |
---|---|---|
committer | scivision <scivision@users.noreply.github.com> | 2023-09-20 18:22:37 (GMT) |
commit | b56d4e041a62985b1e9c757a1b12c6cf3f2f4ae4 (patch) | |
tree | 3d6a64b328dfc6c9e2aea47238ced933f2bf47ef /Modules/FindJava.cmake | |
parent | bab9a237241519066d77a2d1846b181e21fda963 (diff) | |
download | CMake-b56d4e041a62985b1e9c757a1b12c6cf3f2f4ae4.zip CMake-b56d4e041a62985b1e9c757a1b12c6cf3f2f4ae4.tar.gz CMake-b56d4e041a62985b1e9c757a1b12c6cf3f2f4ae4.tar.bz2 |
FindJava: use cmake_host_system_info to query registry
Diffstat (limited to 'Modules/FindJava.cmake')
-rw-r--r-- | Modules/FindJava.cmake | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 2a409ef..74e424b 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -90,13 +90,12 @@ if(_JAVA_HOME) endif() if (WIN32) macro (_JAVA_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._]+" _JAVA_VERSIONS "${_JAVA_VERSIONS}") - string (REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\JavaSoft\\\\${_KIND}\\\\([0-9._]+)" "\\1" _JAVA_VERSIONS "${_JAVA_VERSIONS}") + cmake_host_system_information(RESULT _JAVA_VERSIONS + QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/JavaSoft/${_KIND}" + SUBKEYS) + if (_JAVA_VERSIONS) + string (REGEX MATCHALL "[0-9._]+" _JAVA_VERSIONS "${_JAVA_VERSIONS}") + string (REGEX REPLACE "([0-9._]+)" "\\1" _JAVA_VERSIONS "${_JAVA_VERSIONS}") if (_JAVA_VERSIONS) # sort versions. Most recent first list (SORT _JAVA_VERSIONS COMPARE NATURAL ORDER DESCENDING) |