I'm not sure if this is a pattern of some sort or if it is unique to Find_Boost, but using EXACT with find_package(Boost), as described here <https://cmake.org/cmake/help/v3.0/module/FindBoost.html>, will fail to find the correct boost version depending on the location of other boost versions.
In FindBoost.cmake <https://github.com/Kitware/CMake/blob/5fdd7d21f432e7a43a0cfa1a26da2d92217c7a60/Modules/FindBoost.cmake#L998>, a list of potential boost search directories and path suffices are used to look for boost/config.hpp. Once _any_ directory that contains boost/config.hpp is found, Boost_INCLUDE_DIR is set. After which, ${Boost_INCLUDE_DIR}/boost/version.hpp is used to extract the version. If this version does not match the one passed to find_package, cmake declares that it cannot find the specified version. Since find_path <https://cmake.org/cmake/help/v3.0/command/find_path.html> has a defined search process, if any other directory that happens to be searched first contains boost/config.hpp, the process will fail, even if the correct directory would have be subsequently found by find_path. One approach to resolve this would be to check the version.hpp value after a find_path call to make sure the correct version was found, and if not, to re-run find_path with, for example NO_CMAKE_PATH, then if that doesn't work, with NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH, and so on. I wanted to run this by everybody before writing the patch, perhaps a cleaner approach could be devised. Cheers Phil
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake