From 55abcb5c0f0571b07a1717665859dbc5a9522f1b Mon Sep 17 00:00:00 2001 From: hitgirl <145181611+hitgil@users.noreply.github.com> Date: Sat, 2 Aug 2025 02:23:26 +0530 Subject: [PATCH] =?UTF-8?q?Fix=20#4863:=20skip=20try=5Frun=20for=20LIBCPP?= =?UTF-8?q?=5FVERSION=5FOUTPUT=20during=20cross=20compil=E2=80=A6=20(#4876?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix #4863: skip try_run for LIBCPP_VERSION_OUTPUT during cross compilation Signed-off-by: Hitgirl * fix #4863: handle cross-compiling in libc++ detection gracefully Signed-off-by: Hitgirl * refactor: move cross-compiling check before cached output detection Signed-off-by: Hitgirl * refactor: move cross-compiling check before cached output detection Signed-off-by: Hitgirl * refactor: move cross-compiling check before cached output detection Signed-off-by: Hitgirl --------- Signed-off-by: Hitgirl Co-authored-by: Hitgirl --- cmake/download_test_data.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/download_test_data.cmake b/cmake/download_test_data.cmake index c5dd2bf70..6f63a08ac 100644 --- a/cmake/download_test_data.cmake +++ b/cmake/download_test_data.cmake @@ -68,10 +68,14 @@ string(REGEX REPLACE "[ ]*\n" "; " CXX_VERSION_RESULT "${CXX_VERSION_RESULT}") message(STATUS "Compiler: ${CXX_VERSION_RESULT}") # determine used C++ standard library (for debug and support purposes) +if(CMAKE_CROSSCOMPILING) + set(LIBCPP_VERSION_OUTPUT_CACHED "could not be detected due to cross-compiling" CACHE STRING "Detected C++ standard library version") +endif() if(NOT DEFINED LIBCPP_VERSION_OUTPUT_CACHED) try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR "${CMAKE_BINARY_DIR}" SOURCES "${CMAKE_SOURCE_DIR}/cmake/detect_libcpp_version.cpp" - RUN_OUTPUT_VARIABLE LIBCPP_VERSION_OUTPUT COMPILE_OUTPUT_VARIABLE LIBCPP_VERSION_COMPILE_OUTPUT + RUN_OUTPUT_VARIABLE LIBCPP_VERSION_OUTPUT + COMPILE_OUTPUT_VARIABLE LIBCPP_VERSION_COMPILE_OUTPUT ) if(NOT LIBCPP_VERSION_OUTPUT) set(LIBCPP_VERSION_OUTPUT "Unknown")