Fix architecture detection with WASM builds

This is a simple mis-understanding between try_compile assuming interest
in the launching part of the thing we try to compile and our
architecture test being interested in the binary.

Change-Id: Ie972b662b6f34699f566649bb2c1e29da35b58c3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-08-28 15:01:23 +02:00
parent add4c4816c
commit 4e5fc66c04

View File

@ -3,9 +3,20 @@ function(run_config_test_architecture)
set(qt_base_configure_tests_vars_to_export)
# Test architecture
set(_arch_file "${CMAKE_CURRENT_BINARY_DIR}/architecture_test")
set(saved_executable_suffix "${CMAKE_EXECUTABLE_SUFFIX}")
# With emscripten the application entry point is a .js file (to be run with node for example), but the
# real "data" is in the .wasm file, so that's where we need to look for the ABI, etc. information.
if (EMSCRIPTEN)
set(CMAKE_EXECUTABLE_SUFFIX ".wasm")
endif()
try_compile(_arch_result "${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/config.tests/arch/arch.cpp"
COPY_FILE "${_arch_file}")
set(CMAKE_EXECUTABLE_SUFFIX "${saved_executable_suffix}")
if (NOT _arch_result)
message(FATAL_ERROR "Failed to compile architecture detection file.")
endif()