Files
eden/externals/cmake-modules/UseCcache.cmake
crueter 89f72d286a [cmake, tools] update CPMUtil and add support for CPMUtil bundled Qt, module updates, cleanups (#3289)
Support for bundled Qt, not through aqtinstall but rather my CI. Multimedia is
implemented too, works on both Windows and Linux, though we don't
actually use it so it doesn't really matter. Contains Declarative and all that so the Quick frontend will work once it becomes a thing.

Some options have changed, notably w.r.t LTO and faster
linker, which are now handled directly in the modules.

CPMUtil also has support for custom dirs (`PackageName_CUSTOM_DIR`) now. Probably most useful for adding external fragment shaders and whatnot.

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3289
2026-01-14 19:29:13 +01:00

35 lines
1.3 KiB
CMake

# SPDX-FileCopyrightText: Copyright 2025 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
## UseCcache ##
# Adds an option to enable CCache and uses it if provided.
# Also does some debug info downgrading to make it easier.
# Credit to DraVee for his work on this
option(USE_CCACHE "Use ccache for compilation" OFF)
set(CCACHE_PATH "ccache" CACHE STRING "Path to ccache binary")
if(USE_CCACHE)
find_program(CCACHE_BINARY ${CCACHE_PATH})
if(CCACHE_BINARY)
message(STATUS "[UseCcache] Found ccache at: ${CCACHE_BINARY}")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_BINARY})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_BINARY})
else()
message(FATAL_ERROR "[UseCcache] USE_CCACHE enabled, but no "
"executable found at: ${CCACHE_PATH}")
endif()
# Follow SCCache recommendations:
# <https://github.com/mozilla/sccache/blob/main/README.md?plain=1#L144>
if(WIN32)
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG
"${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO
"${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endif()
endif()