From 6a66e95caad0c880393cd0b99dc0edecd7d7a751 Mon Sep 17 00:00:00 2001 From: SunBlack Date: Tue, 24 May 2022 21:11:39 +0200 Subject: [PATCH] [vcpkg.cmake][ports.cmake] Prefer STREQUAL over MATCHES (#23014) Co-authored-by: Heiko Thiel --- scripts/buildsystems/vcpkg.cmake | 16 ++++++++-------- scripts/ports.cmake | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 6362c8eaf2..31cee14eb7 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -245,21 +245,21 @@ elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$") set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64) else() - if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 Win64$") + if(CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015 Win64") set(Z_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 ARM$") + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015 ARM") set(Z_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015$") + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015") set(Z_VCPKG_TARGET_TRIPLET_ARCH x86) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$") + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017 Win64") set(Z_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM$") + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017 ARM") set(Z_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$") + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017") set(Z_VCPKG_TARGET_TRIPLET_ARCH x86) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 16 2019$") + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 16 2019") set(Z_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 17 2022$") + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 17 2022") set(Z_VCPKG_TARGET_TRIPLET_ARCH x64) else() find_program(Z_VCPKG_CL cl) diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 581969636b..e8592824fb 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -95,7 +95,7 @@ if(PORT) set(CURRENT_PACKAGES_DIR "${PACKAGES_DIR}/${PORT}_${TARGET_TRIPLET}") endif() -if(CMD MATCHES "^BUILD$") +if(CMD STREQUAL "BUILD") set(CMAKE_TRIPLET_FILE "${TARGET_TRIPLET_FILE}") if(NOT EXISTS "${CMAKE_TRIPLET_FILE}") message(FATAL_ERROR "Unsupported target triplet. Triplet file does not exist: ${CMAKE_TRIPLET_FILE}") @@ -147,7 +147,7 @@ if(CMD MATCHES "^BUILD$") if(DEFINED PORT) include("${SCRIPTS}/build_info.cmake") endif() -elseif(CMD MATCHES "^CREATE$") +elseif(CMD STREQUAL "CREATE") file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}" NATIVE_VCPKG_ROOT_DIR) file(TO_NATIVE_PATH "${DOWNLOADS}" NATIVE_DOWNLOADS) if(NOT DEFINED PORT_PATH)