Skip to content

Commit

Permalink
cmake: don't use ccache on msys2+ninja
Browse files Browse the repository at this point in the history
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 <rkitover@gmail.com>
  • Loading branch information
rkitover committed Feb 14, 2019
1 parent ed29b9c commit 5a77d8f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions CMakeLists.txt
Expand Up @@ -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)
Expand Down

0 comments on commit 5a77d8f

Please sign in to comment.