I would like to do the following: If CCache is present in PATH, use \"ccache g++\" for compilation, else use g++. I tried writing a small my-cmake script containing
I didn't like to set a symlink from g++
to ccache
. And CXX="ccache g++"
didn't work for me as some cmake test case wanted to have just the compiler program without attributes.
So I used a small bash script instead:
#!/bin/bash
ccache g++ "$@"
and saved it as an executable in /usr/bin/ccache-g++
.
Then C configured cmake to use /usr/bin/ccache-g++
as C++ compiler.
This way it passes the cmake test cases and I feel more comfortable than having symlinks that I might forget about in 2 or 3 weeks and then maybe wonder if something doesn't work...