Cmake includes various distribution modules (i.e., populated inside the Modules/
directory of a cmake installation; e.g., /usr/share/cmake-3.5/Modules/FindBoost.cmake
).
This creates challenges when developing code that includes internal libraries with names that conflict with these distribution modules, as find_package(Xyz)
finds the distribution module (/usr/share/cmake-3.5/Modules/FindXyz.cmake
) rather than the user module (/home/user/opt/lib/cmake/Xyz-config.cmake
). I've tried setting CMAKE_FIND_ROOT_PATH
and CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY
, but to no avail.
How can I force cmake to exclude its own distribution modules when evaluating find_package()
?