[CMake] Alternative locations for boost in cmake

Mateusz Loskot mateusz at loskot.net
Thu Oct 24 15:22:00 EDT 2019


On Thu, 24 Oct 2019 at 20:44, Mahmood Naderan <nt_mahmood at yahoo.com> wrote:
>
> Thank you. I tried this command:
>
> cmake -DBoost_NO_SYSTEM_PATHS=ON -DBOOST_INCLUDE_DIR=/storage/users/mnaderan/boost_1_65_1/build/include/ -DBoost_LIBRARY_DIRS=/storage/users/mnaderan/boost_1_65_1/build/lib/ -DBoost_ADDITIONAL_VERSIONS=1.65.1 ..
>
> The paths are correct as you can see below:
>
> $ ls /storage/users/mnaderan/boost_1_65_1/build/lib/
> libboost_atomic.a              libboost_math_tr1l.so.1.65.1
> libboost_atomic.so             libboost_math_tr1.so

>
> However, the cmake command fails with the following error message
>
> -- Could NOT find Boost
> CMake Warning at /storage/users/mnaderan/tools/cmake-3.9.0/share/cmake-3.9/Modules/FindBoost.cmake:769 (message):
>   Imported targets not available for Boost version

You are using very old CMake 3.9 which has no idea about Boost 1.65
https://github.com/Kitware/CMake/blob/v3.9.0/Modules/FindBoost.cmake#L769

Rule #1: Use latest version of CMake, ALWAYS!

There is absolutely no reason or excuse to not to use the latest as there are
- deb packages available https://apt.kitware.com/
- generic installer for any Linux and Windows

Updating CMake is easy-peasy for us lazy programmers with a bit of scripting:
https://github.com/mloskot/wsl-config/blob/master/scripts/install-cmake-latest.sh
https://github.com/mloskot/wsl-config/blob/master/scripts/install-cmake-latest.ps1

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


More information about the CMake mailing list