diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2023-09-08 12:01:22 +0200 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2023-09-11 15:05:47 +0200 |
commit | 9d11e5019016ce62c57f6f6567b01d5916a359a8 (patch) | |
tree | 004c49559df766744f07b3ad138efb085d2661d9 /cmake | |
parent | a9c63e826caebe0ad7621c63fb6e7637a86f59b6 (diff) |
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 <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtExecutableHelpers.cmake | 9 |
1 files changed, 8 insertions, 1 deletions
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() |