CMake: Fixup our Chocolatey bin path discovery.
authorGerald Combs <gerald@wireshark.org>
Tue, 6 Mar 2018 17:34:36 +0000 (09:34 -0800)
committerGerald Combs <gerald@wireshark.org>
Tue, 6 Mar 2018 19:00:56 +0000 (19:00 +0000)
Search for choco.exe directly instead of using PATHS + PATH_SUFFIXES.
Look in %ChocolateyInstall%\bin first. CHOCOLATEY_BIN_PATH is the binary
path. There's no need to append /bin to it.

Change-Id: I732db398bd989bf12222a5cee2c79c0bd4161638
Reviewed-on: https://code.wireshark.org/review/26276
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
cmake/modules/FindAsciidoctor.cmake
cmake/modules/FindChocolatey.cmake
cmake/modules/FindLEX.cmake
cmake/modules/FindXSLTPROC.cmake
cmake/modules/FindYACC.cmake

index d5be880efeda68526d7b9fabb6c1bb6a87a70013..1050d16f438fba7128c07582a229d7e9bf716682 100644 (file)
@@ -14,7 +14,7 @@ FIND_PROGRAM(ASCIIDOCTOR_EXECUTABLE
         /bin
         /usr/bin
         /usr/local/bin
-        ${CHOCOLATEY_BIN_PATH}/bin
+        ${CHOCOLATEY_BIN_PATH}
     DOC "Path to Asciidoctor or AsciidoctorJ"
 )
 
index 9f486dbd84e68325f96c8fdb05aa6df8362f477d..172335f9b9b887aac2e56c45e2941c568ef5fa04 100644 (file)
 #  License text for the above reference.)
 
 if (WIN32)
-  find_path(CHOCOLATEY_BIN_PATH
-    choco.exe
-    PATHS "C:/ProgramData/chocolatey" "C:/Chocolatey" ENV ChocolateyInstall
-    PATH_SUFFIXES bin
-    DOC "Chocolatey binary path"
-    NO_DEFAULT_PATH
-  )
+    if (ENV{ChocolateyInstall})
+        set(_chocolateyinstall_bin "$ENV{ChocolateyInstall}/bin")
+    endif()
 
-  mark_as_advanced(
-    CHOCOLATEY_BIN_PATH
-  )
+    find_path(CHOCOLATEY_BIN_PATH
+        choco.exe
+        PATHS
+            $_chocolateyinstall_bin
+            "$ENV{ProgramData}/chocolatey/bin"
+            C:/Chocolatey/bin
+        DOC "Chocolatey binary path"
+        NO_DEFAULT_PATH
+    )
+
+    mark_as_advanced(
+        CHOCOLATEY_BIN_PATH
+    )
 endif ()
index 3ec7db30c5692606fb3f4647d3f1ccb61d8517c8..f7d010b732317c933766c6c684198a70a92138d8 100644 (file)
@@ -11,7 +11,7 @@ FIND_PROGRAM(LEX_EXECUTABLE
     flex
     lex
   PATHS
-    ${CHOCOLATEY_BIN_PATH}/bin
+    ${CHOCOLATEY_BIN_PATH}
     ${CYGWIN_INSTALL_PATH}/bin
     /bin
     /usr/bin
index d82aaf5b1b7d592f27a9c1a4d501315f5b3e0741..5cab1398bfb18c0f69dc43f8df36aa15a7bebbbf 100644 (file)
@@ -3,6 +3,7 @@
 # This module looks for some usual Unix commands.
 #
 
+include(FindChocolatey)
 include(FindCygwin)
 
 # Strawberry Perl ships with xsltproc but no DocBook XML files, which
@@ -12,7 +13,7 @@ find_program(XSLTPROC_EXECUTABLE
   NAMES
     xsltproc
   HINTS
-    ${ChocolateyInstall}/bin
+    ${CHOCOLATEY_BIN_PATH}
     ${CYGWIN_INSTALL_PATH}/bin
   PATHS
     /usr/local/bin
index b32fd4d4e97c6f6f4129a69813ef22cbb2f4ae68..9360d71a1a37bf24c2059c52e09391dbdcacd147 100644 (file)
@@ -11,7 +11,7 @@ FIND_PROGRAM(YACC_EXECUTABLE
     bison
     yacc
   PATHS
-    ${CHOCOLATEY_BIN_PATH}/bin
+    ${CHOCOLATEY_BIN_PATH}
     ${CYGWIN_INSTALL_PATH}/bin
     /bin
     /usr/bin