Add the QT_INTERNAL_CONFIGURE_FROM_IDE option

This switch should help switch off some time consuming operations
that make sense only whe configuring Qt project from IDE.

The switch is INTERNAL and depends on environment variables defined
by IDE application when running cmake:
- Qt Creator, detected by QTC_RUN environment variable
- CLion, detected by CLION_IDE environment variable
- Visual Studio Code, detected by VSCODE_CLI environment variable

Pick-to: 6.5
Change-Id: I44086376109a8af8ebb7ecd8bf64dc34f0631527
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexey Edelev 2023-02-21 12:57:02 +01:00
parent 7db28fb4bd
commit d1d80d7be5

View File

@ -179,6 +179,16 @@ if(PROJECT_NAME STREQUAL "QtBase")
"A path to the source tree of the previously configured QtBase project." FORCE)
endif()
# QT_INTERNAL_CONFIGURE_FROM_IDE is set to TRUE for the following known IDE applications:
# - Qt Creator, detected by QTC_RUN environment variable
# - CLion, detected by CLION_IDE environment variable
# - Visual Studio Code, detected by VSCODE_CLI environment variable
if("$ENV{QTC_RUN}" OR "$ENV{CLION_IDE}" OR "$ENV{VSCODE_CLI}")
set(QT_INTERNAL_CONFIGURE_FROM_IDE TRUE CACHE INTERNAL "Configuring Qt Project from IDE")
else()
set(QT_INTERNAL_CONFIGURE_FROM_IDE FALSE CACHE INTERNAL "Configuring Qt Project from IDE")
endif()
if(FEATURE_developer_build)
if(DEFINED QT_CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ${QT_CMAKE_EXPORT_COMPILE_COMMANDS})