From 4e00fa605b5872fb0602179884f03445dc779dfc Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Mon, 16 Dec 2019 00:56:10 +0000 Subject: [PATCH] cmake: Make wrong vcpkg arch error more clear. Followup on 49ca52ba. Improve the code that shows a fatal error if the vcpkg target architecture does not match the build environment, by showing both the target architecture and the build environment architecture. Signed-off-by: Rafael Kitover --- cmake/Architecture.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/Architecture.cmake b/cmake/Architecture.cmake index 3368cac5..60842355 100644 --- a/cmake/Architecture.cmake +++ b/cmake/Architecture.cmake @@ -17,16 +17,16 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64") set(ASM_DEFAULT ON) set(X86_32 ON) set(WINARCH x86) - - if(DEFINED VCPKG_TARGET_TRIPLET AND (NOT VCPKG_TARGET_TRIPLET MATCHES "^x86-")) - message(FATAL_ERROR "ERROR: Wrong build environment architecture for VCPKG_TARGET_TRIPLET") - endif() else() set(AMD64 ON) set(WINARCH x64) + endif() - if(DEFINED VCPKG_TARGET_TRIPLET AND (NOT VCPKG_TARGET_TRIPLET MATCHES "^x64-")) - message(FATAL_ERROR "ERROR: Wrong build environment architecture for VCPKG_TARGET_TRIPLET") + if(DEFINED VCPKG_TARGET_TRIPLET) + string(REGEX MATCH "^x[86][64]" target_arch ${VCPKG_TARGET_TRIPLET}) + + if(NOT WINARCH STREQUAL target_arch) + message(FATAL_ERROR "Wrong build environment architecture for VCPKG_TARGET_TRIPLET, you specified ${target_arch} but your compiler is for ${WINARCH}") endif() endif() endif()