When I run cmake
with some projects such as caffe
or gflags
, it writes some information at the system level. Specifically, on a linux system, it generates some directories such as $HOME/.cmake/Caffe
and $HOME/.cmake/gflags
My problem is that this information is hereafter used for any project I compile. As a consequence, the programs referenced in $HOME/.cmake
are (partially) found, even if I do not want it (as far as I am concerned, I define external variables to control with external programs cmake
is allowed to consider for a given compilation).
y current solution is to delete the directory $HOME/.cmake
when needed (i.e before compiling my new program). I consider to add a rm -rf $HOME/.cmake
in .bashrc
but this not fully satisfactory (nor sophisticated!). Could anyone propose a better solution ?
NB: the expression “system cache” in the question is probably wrong. I would be grateful to get a better term. Thank you for any feedback on this (actually, if I knew the correct expression, I may have already found the solution on the web…)
Edit:
Once you know the “system cache” is actually the User Package Registry the answer is easy. See below…
Advertisement
Answer
The directory $HOME/.cmake
is the User Package Registry. To avoid find_package()
to search in this directory, use option NO_CMAKE_PACKAGE_REGISTRY
. See point 6 of its documentation: