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 <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-12-16 00:56:10 +00:00
parent 49ca52ba03
commit 4e00fa605b
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 6 additions and 6 deletions

View File

@ -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()