@@ -15,44 +15,25 @@ add_subdirectory(Code)
1515
1616# If we are building on windows for windows, try and get the game install path from the registry.
1717if ("${CMAKE_HOST_SYSTEM} " MATCHES "Windows" AND "${CMAKE_SYSTEM} " MATCHES "Windows" )
18- # Check the EA App/CD registry path (checks both 32-bit and 64-bit registry views)
19- if (NOT RTS_INSTALL_PREFIX_ZEROHOUR)
20- cmake_host_system_information (RESULT _zerohour_path
21- QUERY WINDOWS_REGISTRY
22- "HKEY_LOCAL_MACHINE/SOFTWARE/Electronic Arts/EA Games/Command and Conquer Generals Zero Hour"
23- VALUE InstallPath
24- VIEW 32_64
25- ERROR_VARIABLE _reg_error)
26- if (NOT _reg_error AND _zerohour_path)
27- set (RTS_INSTALL_PREFIX_ZEROHOUR "${_zerohour_path} " CACHE PATH "Zero Hour install path from registry" )
28- endif ()
29- endif ()
18+ include (${CMAKE_SOURCE_DIR} /cmake/registry.cmake)
3019
31- # Check the "First Decade" registry path
32- if (NOT RTS_INSTALL_PREFIX_ZEROHOUR)
33- cmake_host_system_information (RESULT _zerohour_path
34- QUERY WINDOWS_REGISTRY
35- "HKEY_LOCAL_MACHINE/SOFTWARE/Electronic Arts/EA Games/Command and Conquer The First Decade"
36- VALUE zh_folder
37- VIEW 32_64
38- ERROR_VARIABLE _reg_error)
39- if (NOT _reg_error AND _zerohour_path)
40- set (RTS_INSTALL_PREFIX_ZEROHOUR "${_zerohour_path} " CACHE PATH "Zero Hour install path from registry" )
41- endif ()
42- endif ()
20+ # Check the EA App/CD registry path
21+ try_set_install_prefix_from_registry(RTS_INSTALL_PREFIX_ZEROHOUR
22+ "HKEY_LOCAL_MACHINE/SOFTWARE/Electronic Arts/EA Games/Command and Conquer Generals Zero Hour"
23+ InstallPath
24+ "Zero Hour install path from registry" )
4325
44- # Check alternate registry location (ZeroHour vs full name)
45- if (NOT RTS_INSTALL_PREFIX_ZEROHOUR)
46- cmake_host_system_information (RESULT _zerohour_path
47- QUERY WINDOWS_REGISTRY
48- "HKEY_LOCAL_MACHINE/SOFTWARE/Electronic Arts/EA Games/ZeroHour"
49- VALUE installPath
50- VIEW 32_64
51- ERROR_VARIABLE _reg_error)
52- if (NOT _reg_error AND _zerohour_path)
53- set (RTS_INSTALL_PREFIX_ZEROHOUR "${_zerohour_path} " CACHE PATH "Zero Hour install path from registry" )
54- endif ()
55- endif ()
26+ # Check the "First Decade" registry path
27+ try_set_install_prefix_from_registry(RTS_INSTALL_PREFIX_ZEROHOUR
28+ "HKEY_LOCAL_MACHINE/SOFTWARE/Electronic Arts/EA Games/Command and Conquer The First Decade"
29+ zh_folder
30+ "Zero Hour install path from registry" )
31+
32+ # Check the Steam registry path
33+ try_set_install_prefix_from_registry(RTS_INSTALL_PREFIX_ZEROHOUR
34+ "HKEY_LOCAL_MACHINE/SOFTWARE/Electronic Arts/EA Games/ZeroHour"
35+ installPath
36+ "Zero Hour install path from registry" )
5637endif ()
5738
5839if (RTS_INSTALL_PREFIX_ZEROHOUR)
0 commit comments