From f8af82e3b3c16856ddb55eff196626da2f4d8843 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 17 Aug 2020 16:31:38 +0200 Subject: [PATCH] CMake: Fix usage of ccache when no executable was found Change-Id: Ia9a44234cb074fa5ba2b1dc9ca22a676d1b2d4ce Reviewed-by: Joerg Bornemann --- cmake/QtSetup.cmake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index a3584190aba..04bb41f0c06 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -206,7 +206,12 @@ include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/extra-cmake-modules/modules/ECMEnable option(QT_USE_CCACHE "Enable the use of ccache") if(QT_USE_CCACHE) find_program(CCACHE_PROGRAM ccache) - set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") - set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") - set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + if(CCACHE_PROGRAM) + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + set(CMAKE_OBJCXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + else() + message(WARNING "Ccache use was requested, but the program was not found.") + endif() endif()