From 5a77d8f4ba85af1c14e4ec1729d150751f721a62 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Thu, 14 Feb 2019 14:58:13 -0800 Subject: [PATCH] cmake: don't use ccache on msys2+ninja When using msys ccache with a mingw ninja, the compiler fails to execute. Don't try to detect ccache when using the Ninja generator on msys2, it can still be specified through cmake variables. Do not check for the mingw ccache because it is broken and I will assume not being used. Signed-off-by: Rafael Kitover --- CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0c35776..c624a9ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,12 +40,15 @@ endif() set(ASM_DEFAULT OFF) # use ccache if available, and not already enabled on the command line -if(NOT CMAKE_CXX_COMPILER_LAUNCHER AND NOT CMAKE_C_COMPILER_LAUNCHER) - find_program(CCACHE_FOUND ccache) - if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) - endif(CCACHE_FOUND) +# but not with ninja and msys ccache on msys2 +if(NOT (WIN32 AND (NOT $ENV{MSYSTEM} STREQUAL "") AND CMAKE_GENERATOR STREQUAL Ninja)) + if(NOT CMAKE_CXX_COMPILER_LAUNCHER AND NOT CMAKE_C_COMPILER_LAUNCHER) + find_program(CCACHE_FOUND ccache) + if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif(CCACHE_FOUND) + endif() endif() if(NOT CMAKE_SYSTEM_PROCESSOR)