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)