diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-10-19 19:50:25 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-10-23 01:32:34 +0200 |
commit | 2a3a99fe44d18e3560a4b7a05c230a59335da401 (patch) | |
tree | df28bbfb5fd01e2a8323edb66506ad6c1e1e63fa /cmake | |
parent | 7c23281db31aa55b0fe3cce85cb018a1206dccb1 (diff) |
CMake: Use compiler launcher for headerclean rules
This ensures ccache or sccache is used to cache the compilation of the
headerclean checks.
Task-number: QTBUG-82615
Change-Id: Ie944eb1d643e7271551c9f8337609741e419e9d8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtHeadersClean.cmake | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cmake/QtHeadersClean.cmake b/cmake/QtHeadersClean.cmake index 0b2debdd79..cabffcd6e7 100644 --- a/cmake/QtHeadersClean.cmake +++ b/cmake/QtHeadersClean.cmake @@ -32,6 +32,12 @@ function(qt_internal_add_headers_clean_target -DQT_USE_QSTRINGBUILDER -DQT_USE_FAST_OPERATOR_PLUS) + set(compiler_to_run "${CMAKE_CXX_COMPILER}") + if(CMAKE_CXX_COMPILER_LAUNCHER) + list(PREPEND compiler_to_run "${CMAKE_CXX_COMPILER_LAUNCHER}") + endif() + + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") @@ -96,7 +102,7 @@ function(qt_internal_add_headers_clean_target add_custom_command( OUTPUT "${artifact_path}" COMMENT "headersclean: Checking header ${header}" - COMMAND "${CMAKE_CXX_COMPILER}" -c ${cxx_flags} ${hcleanFLAGS} + COMMAND ${compiler_to_run} -c ${cxx_flags} ${hcleanFLAGS} -I "${QT_BUILD_DIR}/include" -I "${CMAKE_INSTALL_PREFIX}/include" ${hcleanDEFS} -xc++ "${input_path}" -o${artifact_path} @@ -121,7 +127,7 @@ function(qt_internal_add_headers_clean_target add_custom_command( OUTPUT "${artifact_path}" COMMENT "headersclean: Checking header ${header}" - COMMAND "${CMAKE_CXX_COMPILER}" -nologo -c ${CMAKE_CXX_FLAGS} ${hcleanFLAGS} + COMMAND ${compiler_to_run} -nologo -c ${CMAKE_CXX_FLAGS} ${hcleanFLAGS} -I "${QT_BUILD_DIR}/include" -I "${CMAKE_INSTALL_PREFIX}/include" ${hcleanDEFS} -FI "${input_path}" -Fo${artifact_path} "${source_path}" |