Skip to content

Commit 6485ea3

Browse files
committed
cmake: require runnable ui host compiler
1 parent bea1008 commit 6485ea3

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tools/ui/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,28 @@ set(UI_H "${CMAKE_CURRENT_BINARY_DIR}/ui.h")
3838
if(CMAKE_CROSSCOMPILING)
3939
function(llama_check_host_cxx compiler out_var)
4040
set(src "${CMAKE_CURRENT_BINARY_DIR}/host-cxx-check.cpp")
41-
set(exe "${CMAKE_CURRENT_BINARY_DIR}/host-cxx-check${CMAKE_EXECUTABLE_SUFFIX}")
41+
if(CMAKE_HOST_WIN32)
42+
set(exe "${CMAKE_CURRENT_BINARY_DIR}/host-cxx-check.exe")
43+
else()
44+
set(exe "${CMAKE_CURRENT_BINARY_DIR}/host-cxx-check")
45+
endif()
4246
file(WRITE "${src}" "#include <stdio.h>\nint main() { puts(\"ok\"); return 0; }\n")
47+
set(run_rc 1)
4348
execute_process(
4449
COMMAND "${compiler}" -std=c++17 "${src}" -o "${exe}"
4550
RESULT_VARIABLE rc
4651
OUTPUT_QUIET
4752
ERROR_QUIET
4853
)
4954
if(rc EQUAL 0)
55+
execute_process(
56+
COMMAND "${exe}"
57+
RESULT_VARIABLE run_rc
58+
OUTPUT_QUIET
59+
ERROR_QUIET
60+
)
61+
endif()
62+
if(rc EQUAL 0 AND run_rc EQUAL 0)
5063
set(${out_var} TRUE PARENT_SCOPE)
5164
else()
5265
set(${out_var} FALSE PARENT_SCOPE)

0 commit comments

Comments
 (0)