From 9d11e5019016ce62c57f6f6567b01d5916a359a8 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Fri, 8 Sep 2023 12:01:22 +0200 Subject: Add variable linked to configure-time executables to detect CMakeCache wiping Wiping of CMakeCache should lead to removing of CMakeCache that is generated for configure-time executable. Otherwise configure-time executables might still use wrong compiler or compiler flags. Pick-to: 6.6 6.5 Task-number: QTBUG-116789 Change-Id: I702d5d29e0c5f35a8a36311cf9a84ea7a0f4d781 Reviewed-by: Alexandru Croitor --- cmake/QtExecutableHelpers.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'cmake/QtExecutableHelpers.cmake') diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake index 7295eec448..de3fce6e76 100644 --- a/cmake/QtExecutableHelpers.cmake +++ b/cmake/QtExecutableHelpers.cmake @@ -422,7 +422,8 @@ function(qt_internal_add_configure_time_executable target) ) set(should_build_at_configure_time TRUE) - if(EXISTS "${target_binary_path}" AND EXISTS "${timestamp_file}") + if(QT_INTERNAL_HAVE_CONFIGURE_TIME_${target} AND + EXISTS "${target_binary_path}" AND EXISTS "${timestamp_file}") set(last_ts 0) foreach(source IN LISTS sources) file(TIMESTAMP "${source}" ts "%s") @@ -488,6 +489,10 @@ function(qt_internal_add_configure_time_executable target) endif() endforeach() + if(EXISTS "${target_binary_dir}/CMakeCache.txt") + file(REMOVE "${target_binary_dir}/CMakeCache.txt") + endif() + try_compile(result "${target_binary_dir}" "${target_binary_dir}" @@ -497,6 +502,8 @@ function(qt_internal_add_configure_time_executable target) ) file(WRITE "${timestamp_file}" "") + set(QT_INTERNAL_HAVE_CONFIGURE_TIME_${target} ${result} CACHE INTERNAL + "Indicates that the configure-time target ${target} was built") if(NOT result) message(FATAL_ERROR "Unable to build ${target}: ${try_compile_output}") endif() -- cgit v1.2.3