diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index a3584190ab..04bb41f0c0 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()