From f17a9855f31c3950d74e461aa5cd9085344d6ca8 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Sun, 10 Mar 2024 15:58:25 -0700 Subject: [PATCH] [CI] Look for pwsh in addition to powerhsell (#1239) Newer github actions bot setup no longer include a powershell.exe binary, only pwsh.exe --- CMakeLists.txt | 9 +++++++++ cmake/Set-Toolchain-vcpkg.cmake | 8 +------- src/wx/CMakeLists.txt | 6 ------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bcced853..1ab37708 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,15 @@ set(VCPKG_DEPS_OPTIONAL ffmpeg ENABLE_FFMPEG ) +if(WIN32) + find_program(POWERSHELL + NAMES powershell.exe pwsh.exe + HINTS "/Windows/System32/WindowsPowerShell/v1.0" + REQUIRED) +else() + find_program(powershell pwsh REQUIRED) +endif() + include(Set-Toolchain-vcpkg) set(VBAM_STATIC_DEFAULT OFF) diff --git a/cmake/Set-Toolchain-vcpkg.cmake b/cmake/Set-Toolchain-vcpkg.cmake index a0365c5f..7b4bba14 100644 --- a/cmake/Set-Toolchain-vcpkg.cmake +++ b/cmake/Set-Toolchain-vcpkg.cmake @@ -277,12 +277,6 @@ function(get_binary_packages vcpkg_exe) FetchContent_Populate(vcpkg_binpkg) endif() - if(WIN32) - find_program(powershell powershell.exe HINTS "/Windows/System32/WindowsPowerShell/v1.0" REQUIRED) - else() - find_program(powershell pwsh REQUIRED) - endif() - unset(to_install) foreach(pkg ${binary_packages}) if(NOT pkg MATCHES "([^_]+)_([^_]+)_([^.]+)[.]zip") @@ -292,7 +286,7 @@ function(get_binary_packages vcpkg_exe) set(pkg_version ${CMAKE_MATCH_2}) set(pkg_triplet ${CMAKE_MATCH_3}) - vcpkg_is_installed(${vcpkg_exe} ${pkg_name} ${pkg_version} ${pkg_triplet} ${powershell} pkg_installed) + vcpkg_is_installed(${vcpkg_exe} ${pkg_name} ${pkg_version} ${pkg_triplet} ${POWERSHELL} pkg_installed) if(NOT pkg_installed) list(APPEND to_install ${pkg}) diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index bf21bb80..aac6e0a3 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -94,12 +94,6 @@ if (WIN32) add_definitions(-D_UNICODE -DUNICODE -DwxUSE_GUI=1 -D__WXMSW__ -DWINVER=0x0A00 -DNTDDI_VERSION=0x0A000007) endif() -if(CMAKE_HOST_WIN32) - find_program(POWERSHELL powershell.exe HINTS "/Windows/System32/WindowsPowerShell/v1.0" REQUIRED) -else() - find_program(POWERSHELL pwsh) -endif() - find_program(ZIP_PROGRAM zip) if(ZIP_PROGRAM) set(ZIP_PROGRAM "${ZIP_PROGRAM}" CACHE STRING "zip compressor executable" FORCE)