FindBoost: Issue finding the correct boost version if 1.65.1 and 1.73.0 are installed when using cmake v3.16.4
Cmake version: v3.16.4
OS: Ubuntu 18.4 (LTS)
Issue:
I have some projects (A) where i play around with a new boost version (1.73.0) and some projects (B) where i need 1.65.1.
I have a local install of the new version and a system install of the old one.
The new version is added to the cmake prefix path.
I added a find_package with exact 1.65.1 to B.
But cmake keeps finding the new version instead of the old one.
This happens evean after creating a local install for 1.65.1 and prepending it to cmake prefix path.
Here are the error messages:
[...] -- 1.73.0 CMake Warning at /home/user/.localinstall/cmake/v3.16.4/share/cmake-3.16/Modules/FindBoost.cmake:1162 (message): New Boost version may have incorrect or missing dependencies and imported targets Call Stack (most recent call first): /home/user/.localinstall/cmake/v3.16.4/share/cmake-3.16/Modules/FindBoost.cmake:1284 (_Boost_COMPONENT_DEPENDENCIES) /home/user/.localinstall/cmake/v3.16.4/share/cmake-3.16/Modules/FindBoost.cmake:1922 (_Boost_MISSING_DEPENDENCIES) CMakeLists.txt:45 (FIND_PACKAGE) [...] CMake Error at /home/user/.localinstall/cmake/v3.16.4/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): Could NOT find Boost: Found unsuitable version "1.73.0", but required is exact version "1.65.1" (found /home/user/.localinstall/boost/boost-1.65.1/include) Call Stack (most recent call first): /home/user/.localinstall/cmake/v3.16.4/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:391 (_FPHSA_FAILURE_MESSAGE) /home/user/.localinstall/cmake/v3.16.4/share/cmake-3.16/Modules/FindBoost.cmake:2180 (find_package_handle_standard_args) CMakeLists.txt:45 (FIND_PACKAGE) -- Configuring incomplete, errors occurred!
Is there some other workaround without specifying the root path for boost or other manual steps? (I am fine with building cmake master) If this is a general issue, I would consider this to be a bug (even if it only affects a very small user base).