On Windows find the standard html viewer by using bigger and bigger
authorjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 10 Nov 2013 14:42:49 +0000 (14:42 +0000)
committerjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 10 Nov 2013 14:42:49 +0000 (14:42 +0000)
hammers only to realize that this really needs to be done at runtime.
Commit it anyway.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@53226 f5534014-38df-0310-8fa8-9805f1628bb7

cmake/modules/FindHtmlViewer.cmake

index 645d32cba7a09b9382b0412f77d2a2f7c9bc4bbb..18bafcb98947d51fdbc89846b438696b64966568 100644 (file)
@@ -6,17 +6,15 @@
 #  HTML_VIEWER_EXECUTABLE - the full path to perl
 #  HTML_VIEWER_FOUND      - If false, don't attempt to use perl.
 
-INCLUDE(FindCygwin)
+include( FindCygwin )
 
-FIND_PROGRAM(HTML_VIEWER_EXECUTABLE
+find_program( HTML_VIEWER_EXECUTABLE
   NAMES
     xdg-open
     mozilla
     htmlview
     open
     $ENV{HTML_VIEWER}
-    [HKEY_CURRENT_USER\\Software\\Classes\\http\\shell\\open\\command]
-    [HKEY_CLASSES_ROOT\\http\\shell\\open\\command]
   PATHS
     ${CYGWIN_INSTALL_PATH}/bin
     /bin
@@ -25,11 +23,26 @@ FIND_PROGRAM(HTML_VIEWER_EXECUTABLE
     /sbin
 )
 
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(HtmlViewer DEFAULT_MSG HTML_VIEWER_EXECUTABLE)
+if( NOT HTML_VIEWER_EXECUTABLE AND WIN32 )
+  foreach( _KEY
+    [HKEY_CURRENT_USER\\Software\\Classes\\http\\shell\\open\\command]
+    [HKEY_CLASSES_ROOT\\http\\shell\\open\\command]
+  )
+    get_filename_component( _NAME_WE ${_KEY} NAME_WE )
+    get_filename_component( _PATH ${_KEY} PATH )
+    string(REGEX REPLACE "\"" "" _NAME_WE ${_NAME_WE})
+    string(REGEX REPLACE "\"" "" _PATH ${_PATH})
+    find_program( HTML_VIEWER_EXECUTABLE "${_PATH}/${_NAME_WE}" NO_DEFAULT_PATH )
+    if( HTML_VIEWER_EXECUTABLE )
+      break()
+    endif()
+  endforeach()
+endif()
+
+include( FindPackageHandleStandardArgs )
+find_package_handle_standard_args( HtmlViewer DEFAULT_MSG HTML_VIEWER_EXECUTABLE )
 
 # For compat with configure
-SET(HTML_VIEWER ${HTML_VIEWER_EXECUTABLE})
-
+set( HTML_VIEWER ${HTML_VIEWER_EXECUTABLE} )
 
-MARK_AS_ADVANCED(HTML_VIEWER_EXECUTABLE)
+mark_as_advanced( HTML_VIEWER_EXECUTABLE )