Skip to content

Conversation

perseoGI
Copy link
Contributor

@perseoGI perseoGI commented Feb 21, 2025

Credits: https://github.com/mradugin/cmake-findccache/blob/47c20441ce923d1751faf104d1914204acdd31d7/

TODO

  • Check if we want to use the Visual Studio auto injection part
  • Consider adding the rest of the toolchain file from cmake-findccache repo

@CLAassistant
Copy link

CLAassistant commented Feb 21, 2025

CLA assistant check
All committers have signed the CLA.

@KUGA2
Copy link

KUGA2 commented Aug 4, 2025

Have you successfully tested this with Windows+CMake+MSVC+Debug/RelWithDebInfo? Because in my tests this does not work. ccache does not cache anything, cause ccache/ccache#1040
(You can see then when you print debug logs of CCACHE)

You need to change the debug info type:

By default Visual Studio generators will use /Zi which is not compatible
with ccache, so tell Visual Studio to use /Z7 instead.
message(STATUS "Setting MSVC debug information format to 'Embedded'")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")

https://github.com/ccache/ccache/wiki/MS-Visual-Studio

However, at least in our case, changing this is not acceptable. We build RelWithDebInfo, but do not want to distribute debug info. And splitting, like with gcc/elf is not possible AFAIK.

def package_info(self):
self.cpp_info.libdirs = []
self.cpp_info.includedirs = []
if self.conf.get("user.ccache:auto_inject", default=True, check_type=bool):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a new remote/repo/recipe? Why can't we integrate that in the regular ccache (conan-center) recipe? What is different if auto_inject=False (default)?

if can_run(self):
self.run("ccache --version", env="conanbuild")
self.run("ccache --get-config hash_dir", env="conanbuild")
self.run("ccache --get-config base_dir", env="conanbuild")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also verify that ccache works:
In the test project, change the cache_dir (CCACHE_DIR) to a temporary, clean dir. Then after build, verify that the cache has 1 entry (ccache -s)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants