`find_package` searches home directory for *config.cmake-file
This issue was encountered with CMake 3.10.2 (built from source) running on Ubuntu 16.04.3.
After much head scratching it turns out that when calling find_package(<package>)
for a Config-style find package module, the home directory is searched for directories named with the prefix <package> containing a file named <package>-config.cmake.
I see no reason in my environment variables that the home directory should be searched. Neither do I have a ~/.cmake/
directory as mentioned here. Furthermore, I see no mention in the documentation that find_package()
searches the home directory.
Thus I have a few questions:
- Is this the expected behaviour? If so, please update the documentation.
- Is there a way to disable this behaviour?
- Is there a way to list which directories that
find_package()
searches when using it in Config-mode.
In my case I encountered this issue after having built (and installed) a dependency from source. This was done from my home directory. Seeing as this is not an unreasonable usage case in my opinion, having cmake automatically search the home directory for projects containing config-files seems slightly problematic to me.