Files
CMake/Tests/RunCMake/try_run/CrossCompile.cmake
Brad King 2f85ec0a37 try_run: Avoid crash in keyword-dispatched signature when cross-compiling
Since commit aa9220d3a0 (try_compile: Add keyword-dispatched signature,
2022-09-02, v3.25.0-rc1~178^2) the `DoNotRunExecutable` code path may be
reached with no single source-file argument.  Do not assume it exists.

Fixes: #24295
2023-01-12 11:04:16 -05:00

9 lines
301 B
CMake

include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
# Pretend we are cross-compiling to take that try_run code path.
set(CMAKE_CROSSCOMPILING 1)
set(RUN_RESULT 0)
try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/src.c)
unset(CMAKE_CROSSCOMPILING)