[CMake] CMake's FindBoost Module Can't Detect Boost Version

Deniz Bahadir dbahadir at benocs.com
Wed Dec 18 08:50:22 EST 2019


Am 17.12.19 um 17:35 schrieb Mateusz Loskot:
> On Tue, 17 Dec 2019 at 16:39, Osman Zakir <osmanzakir90 at hotmail.com> wrote:
>>
>> I built Boost 1.72.0 while passing the "--layout=versioned" flag to b2, but when I tried to rebuild Jinja2Cpp with the newer version of Boost using CMake, it failed to generate project files and said it couldn't filesystem and system and also couldn't detect version information.  Could someone please help me out with this?
> 
> I recall you have been asking similar questions in the past about Jinja2Cpp.
> 
> You have received number of useful suggestions [1], e.g. to use
> -DBoost_DEBUG=ON,
> and investigate detailed diagnostics, to try -DBoost_COMPILER=...
> and -DBoost_ARCHITECTURE hints, etc.
> Please, apply this knowledge.
> 
> Finally, your questions are poorly formulated e.g. my crystal sphere has broken
> and I can't figure out what compiler, toolset, cmake version, etc. you are on.
> Next time, try to help people help you [2]
> 
> [1] https://cmake.org/pipermail/cmake/2018-October/068477.html
> [2] http://www.catb.org/~esr/faqs/smart-questions.html
> 
> Best regards,
> 

Osman,

as you are obviously trying to to find a pretty recent Boost version 
(1.72.0) that you even built yourself, you could probably try to skip 
the Module-mode of the `find_package(Boost ...)` call and instead try to 
use the Config-mode directly, like this:
```
find_package(Boost 1.72.0 EXACT CONFIG ...)
```

Thereby, you are skipping CMake's FindBoost module entirely and instead 
rely on the BoostConfig.cmake file provided by Boost itself. (Then you 
can even skip defining the `Boost_ADDITIONAL_VERSIONS` variable.)
However, if you did not install your Boost version in one of the 
default-locations you probably need to provide some HINTs or PATHs to 
`find_package`.
See [3] for further information.

Nevertheless, if you have a pretty recent version of CMake with a pretty 
recent version of its FindBoost module, then even in Module mode the 
FindBoost module will first try to find BoostConfig.cmake.


[3] 
https://cmake.org/cmake/help/latest/command/find_package.html#full-signature-and-config-mode


Best regards,
Deniz

PS: This mailing-list will probably be discontinued within the next few 
weeks. For future questions you should probably switch to 
https://discourse.cmake.org, as that is the successor of the CMake 
mailing-lists.


More information about the CMake mailing list