From: Ingvar Stepanyan Date: Fri, 4 Nov 2022 16:31:13 +0000 (+0000) Subject: Use CMake detection for Emscripten due to a bug in vcpkg. X-Git-Tag: 2.1.0-beta1~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=595f050b9f7324fb3ad840dae2a6de4f7d5a3de7;p=thirdparty%2Fzlib-ng.git Use CMake detection for Emscripten due to a bug in vcpkg. When installing for wasm32 with vcpkg, CMake's try_run does not end up running with the correct compiler. This issue has been mention in a few existing vcpkg portfiles. Alternatively, we could check the VCPKG_TARGET_ARCHITECTURE variable for wasm32 but instead we check for EMSCRIPTEN CMake variable. --- diff --git a/cmake/detect-arch.cmake b/cmake/detect-arch.cmake index 6f29c4a10..21c237d61 100644 --- a/cmake/detect-arch.cmake +++ b/cmake/detect-arch.cmake @@ -16,6 +16,8 @@ elseif(MSVC) elseif ("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64") set(ARCH "aarch64") endif() +elseif(EMSCRIPTEN) + set(ARCH "wasm32") elseif(CMAKE_CROSSCOMPILING) set(ARCH ${CMAKE_C_COMPILER_TARGET}) else()