As a long-time user of and advocate for 'ccache', I can attest that CMake has good behaviour on its own: just tell it to use 'ccache' if found. There may be more one than way, on a search I see '<LANG>_COMPILER_LAUNCHER' [1]. And that is used in a simple pattern I have relied upon in the past:
# Enable compiler cache to speed up recompilation 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() That should do the trick. On the other hand, I found over the years that manually trying to replicate and outsmart systems in the R package setup is not a winner as one tends to end up in hard-to-debug corners such as the one you find yourself in. I do however always set 'ccache' in my own '~/.R/Makevars' and once every thousand or two packages ('Rcpp' reverse depends let me compile a few) something breaks because the package at hand does such local gymnastics, So in short for your external libraries I would just try to tell CMake to build a static library and to use 'ccache' if found. Cheers, Dirk [1] https://cmake.org/cmake/help/latest/prop_tgt/LANG_COMPILER_LAUNCHER.html -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel