[CMake] Alternative locations for boost in cmake

Mateusz Loskot mateusz at loskot.net
Fri Oct 25 04:41:08 EDT 2019


On Fri, 25 Oct 2019 at 09:54, Mahmood Naderan <nt_mahmood at yahoo.com> wrote:
>
> Even with the latest 3.15.4, I get the same error
>
>   Could NOT find Boost (missing: Boost_INCLUDE_DIR system filesystem timer
>   chrono) (Required is at least version "1.58")

You can try `-DBoost_DEBUG=ON that may give more clues what is happening

In some situations (environment, toolset, Boost build layout, etc.)
FindBoost.cmake,
which by the way is a **guesser** not a rock solid configuration file
like pkg-config that never fails,
may need some extra hints.
Here is copy of suggestions from project I maintain
https://github.com/boostorg/gil/blob/develop/CONTRIBUTING.md#using-cmake

```
TIP: If CMake is failing to find Boost libraries, especially built
with --layout=versioned, you can try a few hacks:

-DBoost_ARCHITECTURE=-x64 to help CMake find Boost 1.66 and above add
an architecture tag to the library file names in versioned build The
option added in CMake 3.13.0.

-DBoost_COMPILER=-gcc5 or -DBoost_COMPILER=-vc141 to help CMake
earlier than 3.13 match your compiler with toolset used in the Boost
library file names (i.e. libboost_unit_test_framework-gcc5-mt-x64-1_69
and not -gcc55-). Fixed in CMake 3.13.0.

if CMake is still failing to find Boost, you may try -DBoost_DEBUG=ON
to get detailed diagnostics output from FindBoost.cmake module.
```

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the CMake mailing list