CMake: Define BUILD_WITH_PCH before usage

On Windows QtCreatorAPIInternal.cmake would contain a check for
BUILD_WITH_PCH and if not set add a few defines to the DEFAULT_DEFINES.

First time the BUILD_WITH_PCH would not be set, because the option
will be set later, the DEFAULT_DEFINES will contain the specific non-pch
defines.

The second time BUILD_WITH_PCH would be ON and those non-pch
specific DEFAULT_DEFINES will be removed, and the build system has
to do a full rebuild because the defines changed.

Change-Id: I3f039a91667affc35f18103cfed062481f9dc93e
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Cristian Adam
2021-10-20 19:06:02 +02:00
parent 428a9ee509
commit 7e62840ec1

View File

@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.10)
## Add paths to check for cmake modules: ## Add paths to check for cmake modules:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(BUILD_WITH_PCH "Build with precompiled headers" ON)
include(FeatureSummary) include(FeatureSummary)
include(QtCreatorIDEBranding RESULT_VARIABLE IDE_BRANDING_FILE) include(QtCreatorIDEBranding RESULT_VARIABLE IDE_BRANDING_FILE)
include(QtCreatorTranslations) include(QtCreatorTranslations)
@@ -67,8 +69,6 @@ endif()
find_package(Qt5 COMPONENTS LinguistTools QUIET) find_package(Qt5 COMPONENTS LinguistTools QUIET)
find_package(Qt5 COMPONENTS Quick QuickWidgets Designer DesignerComponents Help SerialPort Svg Tools QUIET) find_package(Qt5 COMPONENTS Quick QuickWidgets Designer DesignerComponents Help SerialPort Svg Tools QUIET)
option(BUILD_WITH_PCH "Build with precompiled headers" ON)
find_package(Threads) find_package(Threads)
find_package(Clang QUIET) find_package(Clang QUIET)
find_package(KF5SyntaxHighlighting QUIET) find_package(KF5SyntaxHighlighting QUIET)