'How do I stop project with boost dependency finding the wrong ${Boost_INCLUDE_DIRS} location, when building in Visual Studio 2019 with CMake

I am attempting to build the fruit library - https://github.com/google/fruit, in Visual Studio 2019

When I ran the install step for the first time it was unable to find <boost\unordered_map.hpp>

After a quick google, I set BOOST_ROOT as C:\ExtBuildUtils\Boost, which it ignored until I put cmake_minimum_required(VERSION 3.21) at the top of the file and then I saw the following output in the Configure step

1> [CMake] -- Found Boost: C:/ExtBuildUtils/Boost/boost_1_75_0/lib/cmake/Boost-1.75.0/BoostConfig.cmake (found version "1.75.0")

However again when I attempted to install the library it couldn't find <boost\unordered_map.hpp>

I could see that the compiler invocation said -IC:\ExtBuildUtils\Boost, which didn't look right

So I added a message to CMakeLists.txt

message(STATUS "Boost include dirs: ${Boost_INCLUDE_DIRS}")

Which outputs

1> [CMake] -- Boost include dirs: C:/ExtBuildUtils/Boost

OK, so maybe I need to set BOOST_ROOT as C:\ExtBuildUtils\Boost\boost_1_75_0

I made the above modification but it still outputs the exact same location.

How do I stop project with boost dependency finding the wrong ${Boost_INCLUDE_DIRS} location?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source