CMake Build: Fix problems with PCH and super repo

Make sure that every project will have its own precompile headers
sets.

This fixes problems with MSVC.

Change-Id: I37d58c9652f679545283907e7cad70cd579911a8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Cristian Adam
2020-11-13 18:42:32 +01:00
committed by Tim Jenssen
parent b0d72fa952
commit c038abb0ab
+7 -7
View File
@@ -329,7 +329,7 @@ function(enable_pch target)
endif()
endfunction()
if (NOT TARGET QtCreatorPchGui AND NOT TARGET QtCreatorPchConsole)
if (NOT TARGET ${PROJECT_NAME}PchGui AND NOT TARGET ${PROJECT_NAME}PchConsole)
file(GENERATE
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c
CONTENT "/*empty file*/")
@@ -341,17 +341,17 @@ function(enable_pch target)
${CMAKE_CURRENT_BINARY_DIR}/empty_pch.cpp
PROPERTIES GENERATED TRUE)
_add_pch_target(QtCreatorPchGui
"${PROJECT_SOURCE_DIR}/src/shared/qtcreator_gui_pch.h" Qt5::Widgets)
_add_pch_target(QtCreatorPchConsole
"${PROJECT_SOURCE_DIR}/src/shared/qtcreator_pch.h" Qt5::Core)
_add_pch_target(${PROJECT_NAME}PchGui
"${QtCreator_SOURCE_DIR}/src/shared/qtcreator_gui_pch.h" Qt5::Widgets)
_add_pch_target(${PROJECT_NAME}PchConsole
"${QtCreator_SOURCE_DIR}/src/shared/qtcreator_pch.h" Qt5::Core)
endif()
unset(PCH_TARGET)
if ("Qt5::Widgets" IN_LIST dependencies)
set(PCH_TARGET QtCreatorPchGui)
set(PCH_TARGET ${PROJECT_NAME}PchGui)
elseif ("Qt5::Core" IN_LIST dependencies)
set(PCH_TARGET QtCreatorPchConsole)
set(PCH_TARGET ${PROJECT_NAME}Console)
endif()
if (TARGET "${PCH_TARGET}")