From d5c3e1336bce42df53d4b525237244486ba5422d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Mon, 29 Mar 2021 16:27:33 +0200 Subject: [PATCH] Allow to load -developer-build without configurations into an IDE Let -developer-build, -cmake-file-api set up the CMake File API query, so that the build can be loaded directly into IDE's like Qt Creator. [ChangeLog][Build System] configure -developer-build now sets up the CMake File API query, so that a build can be loaded without reconfiguration into Qt Creator and other IDE's. Pass -developer-build -no-cmake-file-api to configure to disable this. Fixes: QTBUG-89487 Change-Id: I69199b8f96da02e42e5610aa6f49881c1582f7da Reviewed-by: Alexandru Croitor Reviewed-by: Edward Welbourne --- cmake/QtProcessConfigureArgs.cmake | 12 ++++++++++++ config_help.txt | 2 ++ 2 files changed, 14 insertions(+) diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index 1affdd56786..f793096e509 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -91,6 +91,12 @@ while(NOT "${configure_args}" STREQUAL "") string(APPEND path "/mkspecs") endif() push("-DINSTALL_MKSPECSDIR=${path}") + elseif(arg STREQUAL "-developer-build") + set(developer_build TRUE) + elseif(arg STREQUAL "-cmake-file-api") + set(cmake_file_api TRUE) + elseif(arg STREQUAL "-no-cmake-file-api") + set(cmake_file_api FALSE) elseif(arg MATCHES "^-host.*dir") message(FATAL_ERROR "${arg} is not supported anymore.") elseif(arg STREQUAL "--") @@ -863,6 +869,12 @@ translate_list_input(includes QT_EXTRA_INCLUDEPATHS) translate_list_input(lpaths QT_EXTRA_LIBDIRS) translate_list_input(rpaths QT_EXTRA_RPATHS) +if(cmake_file_api OR (developer_build AND NOT DEFINED cmake_file_api)) + foreach(file cache-v2 cmakeFiles-v1 codemodel-v2 toolchains-v1) + file(WRITE "${CMAKE_BINARY_DIR}/.cmake/api/v1/query/${file}" "") + endforeach() +endif() + foreach(input ${config_inputs}) qt_feature_normalize_name("${input}" cmake_input) push("-DINPUT_${cmake_input}=${INPUT_${input}}") diff --git a/config_help.txt b/config_help.txt index f010cccf1a6..c89479252e7 100644 --- a/config_help.txt +++ b/config_help.txt @@ -57,6 +57,8 @@ Build options: CMake instead of auto-detecting one. -cmake-use-default-generator ... Turn off auto-detection of the CMake build system generator. + -cmake-file-api ...... Let CMake store build metadata for loading the build + into an IDE. [no; yes if -developer-build] -no-guess-compiler ... Do not guess the compiler from the target mkspec. -release ............. Build Qt with debugging turned off [yes] -debug ............... Build Qt with debugging turned on [no]