aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@qt.io>2019-10-08 17:36:54 +0200
committerCristian Adam <cristian.adam@qt.io>2019-10-09 15:52:08 +0000
commitd769db2c78e9a2ffc905d89a8cd0a7e650458587 (patch)
treec05ba3a2ccb77570d22c54db86f783cae5e568a9 /cmake
parentfe85b9cd82bb79b6aae5ef3294c58040fb6a39be (diff)
CMake Build: Enable PCH build with the latest CMake version
The almost 3.16 CMake version has support for C and C++ PCHs. The library that creates the shared PCHs needs to have also a dummy C file. Change-Id: Ifc9e2ae43522dd5fda5261e938901f6a8ad1898c Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtCreatorAPI.cmake12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake
index 09f9e3f05c..b635c5debb 100644
--- a/cmake/QtCreatorAPI.cmake
+++ b/cmake/QtCreatorAPI.cmake
@@ -309,7 +309,8 @@ function(enable_pch target)
function(_add_pch_target pch_target pch_file pch_dependency)
if (EXISTS ${pch_file})
add_library(${pch_target} STATIC
- ${CMAKE_BINARY_DIR}/empty_pch.cpp)
+ ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c)
target_compile_definitions(${pch_target} PRIVATE ${DEFAULT_DEFINES})
set_target_properties(${pch_target} PROPERTIES
PRECOMPILE_HEADERS ${pch_file})
@@ -318,10 +319,13 @@ function(enable_pch target)
endfunction()
if (NOT TARGET QtCreatorPchGui AND NOT TARGET QtCreatorPchConsole)
- file(WRITE ${CMAKE_BINARY_DIR}/empty_pch.cpp.in "/*empty file*/")
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c_cpp.in "/*empty file*/")
configure_file(
- ${CMAKE_BINARY_DIR}/empty_pch.cpp.in
- ${CMAKE_BINARY_DIR}/empty_pch.cpp)
+ ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c_cpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.cpp)
+ configure_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c_cpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/empty_pch.c)
_add_pch_target(QtCreatorPchGui
"${PROJECT_SOURCE_DIR}/src/shared/qtcreator_gui_pch.h" Qt5::Widgets)