Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / cmake / modules / FindPowerShell.cmake
blob307d7e7982e29849cf980eb43c11a9c7dc41a247
2 # Find PowerShell
3 # This module looks for PowerShell and sets the following:
4 # POWERSHELL_EXECUTABLE - Path to PowerShell.
5 # POWERSHELL_COMMAND - Command suitable for running .ps1 scripts
7 # To do:
8 # - Add a version check
11 find_program(POWERSHELL_EXECUTABLE
12   NAMES
13     powershell
14     pwsh
15   DOC "PowerShell command"
18 INCLUDE(FindPackageHandleStandardArgs)
19 find_package_handle_standard_args(PowerShell DEFAULT_MSG POWERSHELL_EXECUTABLE)
21 set(_powershell_command "POWERSHELL_COMMAND-NOTFOUND")
22 if(POWERSHELL_FOUND)
23   # Calling a script using "-File" doesn't properly return exit codes.
24   # Use dot sourcing instead
25   # https://connect.microsoft.com/PowerShell/feedback/details/777375/powershell-exe-does-not-set-an-exit-code-when-file-is-used
26   set(_powershell_command "${POWERSHELL_EXECUTABLE}" -NoProfile -NonInteractive -executionpolicy bypass .)
27 endif()
28 set(POWERSHELL_COMMAND ${_powershell_command}
29   CACHE STRING "Command suitable for running PowerShell scripts."
32 mark_as_advanced(POWERSHELL_EXECUTABLE POWERSHELL_COMMAND)