diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-03-26 18:20:38 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-03-31 23:27:47 +0200 |
commit | f454cd8d150543fcef7a481b02fd0dbd357ea5ff (patch) | |
tree | e20e0363ed191f640550621337f9601dab5fc552 /cmake/QtBaseConfigureTests.cmake | |
parent | 8f6d8d7cd8eb72570cef91bd00b982d161bb0afd (diff) |
CMake: Make architecture detection failures more verbose
Whenever something went wrong with building the arch test or extracting
info from it, the failure messages lacked useful details.
It's especially hard to figure out what went wrong if the failure
happened in the CI.
Print a bunch of useful information in case of failure.
Change-Id: Iafe287f951880c1441e57924ae372d6a9029a9a7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'cmake/QtBaseConfigureTests.cmake')
-rw-r--r-- | cmake/QtBaseConfigureTests.cmake | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/cmake/QtBaseConfigureTests.cmake b/cmake/QtBaseConfigureTests.cmake index af18131fcd..cbd482bd59 100644 --- a/cmake/QtBaseConfigureTests.cmake +++ b/cmake/QtBaseConfigureTests.cmake @@ -9,16 +9,23 @@ function(qt_run_config_test_architecture) qt_get_platform_try_compile_vars(platform_try_compile_vars) list(APPEND flags ${platform_try_compile_vars}) + list(TRANSFORM flags PREPEND " " OUTPUT_VARIABLE flags_indented) + list(JOIN flags_indented "\n" flags_indented) + message(STATUS + "Building architecture extraction project with the following CMake arguments:\n${flags_indented}") + try_compile( _arch_result "${CMAKE_CURRENT_BINARY_DIR}/config.tests/arch" "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/arch" arch CMAKE_FLAGS ${flags} + OUTPUT_VARIABLE arch_test_output ) if (NOT _arch_result) - message(FATAL_ERROR "Failed to compile architecture detection file.") + message(FATAL_ERROR + "Failed to build architecture extraction project. Build output:\n ${arch_test_output}") endif() set(_arch_file_suffix "${CMAKE_EXECUTABLE_SUFFIX}") @@ -34,11 +41,17 @@ function(qt_run_config_test_architecture) string(APPEND arch_test_location "/${QT_MULTI_CONFIG_FIRST_CONFIG}") endif() + set(arch_dir "${CMAKE_CURRENT_BINARY_DIR}/${arch_test_location}") + file(GLOB arch_dir_globbed_files RELATIVE "${arch_dir}" "${arch_dir}/*") + list(JOIN arch_dir_globbed_files "\n" arch_dir_globbed_files) + set(_arch_file "${CMAKE_CURRENT_BINARY_DIR}/${arch_test_location}/architecture_test${_arch_file_suffix}") if (NOT EXISTS "${_arch_file}") message(FATAL_ERROR - "Failed to find compiled architecture detection executable at ${_arch_file}.") + "Failed to find compiled architecture detection executable at ${_arch_file}. \ + The following files were found at: ${arch_dir} \ + ${arch_dir_globbed_files}") endif() message(STATUS "Extracting architecture info from ${_arch_file}.") @@ -66,7 +79,12 @@ function(qt_run_config_test_architecture) endforeach() if (NOT _architecture OR NOT _build_abi) - message(FATAL_ERROR "Failed to extract architecture data from file.") + list(SUBLIST _arch_lines 0 5 arch_lines_fewer) + list(JOIN arch_lines_fewer "\n" arch_lines_output) + + message(FATAL_ERROR + "Failed to extract architecture data from file. \ + Here are the first few lines extracted:\n${arch_lines_output}") endif() set(TEST_architecture 1 CACHE INTERNAL "Ran the architecture test") |