~widelands-dev/widelands/trunk

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: The Widelands Bunnybot
  • Date: 2025-06-04 21:45:30 UTC
  • Revision ID: bunnybot@widelands.org-20250604214530-6rllaczrfu0sdjob
CMake: Added rule to use ccache by default if installed (CB #5031 / GH #6671)

Co-authored-by: andy5995 <arch_stanton5995@proton.me>
Co-committed-by: andy5995 <arch_stanton5995@proton.me>

(by bunnybot)
7e45ef469341fcda28d4f71495302cafc76ac116

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
# Note: 'CMAKE_INSTALL_PREFIX' defaults to /usr/local on UNIX and c:/Program Files/${PROJECT_NAME} on Windows
80
80
wl_set_if_unset(WL_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/games")
81
81
 
 
82
if(NOT CMAKE_C_COMPILER_LAUNCHER)
 
83
  find_program(CCACHE_PROGRAM ccache)
 
84
  if(CCACHE_PROGRAM)
 
85
    set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE STRING "C Compiler Launcher" FORCE)
 
86
    set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE STRING "CXX Compiler Launcher" FORCE)
 
87
  endif()
 
88
endif()
 
89
 
82
90
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
83
91
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
84
92
    message(FATAL_ERROR "Widelands needs GCC >= 8 to compile.")