From 7e62840ec1021d3118e36ab7fb8a5b484bb9f2a8 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 20 Oct 2021 19:06:02 +0200 Subject: [PATCH] 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 Reviewed-by: Tim Jenssen --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87be55233dd..8911572ca09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.10) ## Add paths to check for cmake modules: list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +option(BUILD_WITH_PCH "Build with precompiled headers" ON) + include(FeatureSummary) include(QtCreatorIDEBranding RESULT_VARIABLE IDE_BRANDING_FILE) include(QtCreatorTranslations) @@ -67,8 +69,6 @@ endif() find_package(Qt5 COMPONENTS LinguistTools 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(Clang QUIET) find_package(KF5SyntaxHighlighting QUIET)