]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Use CMake detection for Emscripten due to a bug in vcpkg.
authorIngvar Stepanyan <me@rreverser.com>
Fri, 4 Nov 2022 16:31:13 +0000 (16:31 +0000)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 5 Dec 2022 22:24:02 +0000 (23:24 +0100)
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.

cmake/detect-arch.cmake

index 6f29c4a1023e088418888dc018eeffbbbd48a3c7..21c237d61a3af01290370af7d56adccae9dd7d18 100644 (file)
@@ -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()