[CMake] Finding Boost in versioned layout on Linux
Mateusz Loskot
mateusz at loskot.net
Wed Oct 24 13:22:18 EDT 2018
Hi,
I know the version layout of Boost build is preferred or
even specific to Windows, but I like it in general, ie. on Linux.
It lazily allows me to get everything built with single command:
b2 variant=debug,release address-model=32,64 --layout=versioned stage
The versioned layout impose some challenges while find_package-ing
at least I've experienced it using FindBoost.cmake from latest CMake 3.12.
For example, running CMake in Linux environment with GCC 5.5.0 for
find_package(Boost 1.65.0 REQUIRED COMPONENTS system)
will attempt to search for
...
-- [ /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1420 ]
guessed _boost_COMPILER = -gcc55
...
-- [ /usr/local/share/cmake-3.12/Modules/FindBoost.cmake:1760 ]
Searching for SYSTEM_LIBRARY_RELEASE:
boost_system-gcc55-mt-1_69;boost_system-gcc55-mt;boost_system-mt-1_69;boost_system-mt;boost_system
...
The issue is that b2 generated names like
libboost_system-gcc5-mt-d-x64-1_69.a
So, I had to bend CMake this way to find Boost for me:
cmake -DBoost_COMPILER=-gcc5 -DCMAKE_CXX_COMPILER_ARCHITECTURE_ID=x64 ..
I'm not asking any specific questions here.
I just thought that might be helpful to other users of FindBoost.cmake.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
More information about the CMake
mailing list