diff --git a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake index c7222c8b718..3d5117d9232 100644 --- a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake +++ b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake @@ -2,6 +2,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Includes QtSetup and friends for private CMake API. +set(QT_INTERNAL_IS_STANDALONE_TEST TRUE) qt_internal_project_setup() qt_build_internals_set_up_private_api() diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 762299f943d..28a349054d7 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -3,10 +3,16 @@ ## Set a default build type if none was specified -# Set the QT_IS_BUILDING_QT variable so we can verify whether we are building -# Qt from source -set(QT_BUILDING_QT TRUE CACHE BOOL +# Set the QT_BUILDING_QT variable so we can verify whether we are building +# Qt from source. +# Make sure not to set it when building a standalone test, otherwise +# upon reconfiguration we get an error about qt_internal_add_test +# not being found due the if(NOT QT_BUILDING_QT) check we have +# in each standalone test. +if(NOT QT_INTERNAL_IS_STANDALONE_TEST) + set(QT_BUILDING_QT TRUE CACHE BOOL "When this is present and set to true, it signals that we are building Qt from source.") +endif() # Pre-calculate the developer_build feature if it's set by the user via the INPUT_developer_build # variable when using the configure script. When not using configure, don't take the INPUT variable diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index a2e9d0baa3d..d94c9e5e462 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -898,7 +898,7 @@ endfunction() # It doesn't overwrite public properties, but instead writes formatted values to internal # properties. function(_qt_internal_android_format_deployment_paths target) - if(QT_BUILD_STANDALONE_TESTS OR QT_BUILDING_QT) + if(QT_BUILD_STANDALONE_TESTS OR QT_BUILDING_QT OR QT_INTERNAL_IS_STANDALONE_TEST) set(android_deployment_paths_policy NEW) else() set(policy_path_properties @@ -1030,7 +1030,7 @@ function(_qt_internal_get_android_abi_cmake_dir_path out_path abi) else() _qt_internal_get_android_abi_prefix_path(prefix_path ${abi}) if((PROJECT_NAME STREQUAL "QtBase" OR QT_SUPERBUILD) AND QT_BUILDING_QT AND - NOT QT_BUILD_STANDALONE_TESTS) + NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_INTERNAL_IS_STANDALONE_TEST) set(cmake_dir "${QT_CONFIG_BUILD_DIR}") else() set(cmake_dir "${prefix_path}/${QT6_INSTALL_LIBS}/cmake")