c++boostcmakesparc

Boost+CMake: no suitable build variant


I am trying to deploy some libraries on embedded SPARC-like machine for project in which I involved. I successfully built bleeding-edge Boost library on this machine and installed it into /util directory. Then I tried to write simple tester script for CMake. Here is the beginning of this script:

cmake_minimum_required(VERSION 2.8.3)
project(cpp_boost_test)
find_package(Boost REQUIRED COMPONENTS system thread)
find_package(console_bridge REQUIRED)
message(STATUS "Boost Includes: ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost Libraries: ${Boost_LIBRARIES}")

While running I receive the following error message:

-- Found Boost 1.70.0 at /util/lib/cmake/Boost-1.70.0
-- Requested configuration: QUIET REQUIRED COMPONENTS
     system;thread
-- Found boost_headers 1.70.0 at /util/lib/cmake/boost_headers-1.70.0
-- Found boost_system 1.70.0 at /util/lib/cmake/boost_system-1.70.0
-- No suitable boost_system variant has been identified!
--   libboost_system.so.1.70.0 (shared, BUILD_SHARED_LIBS not ON, set Boost_USE_STATIC_LIBS=OFF to override)
CMake Error at /util/lib/cmake/Boost-1.70.0/BoostConfig.cmake:60 (find_package):
      Found package configuration file:

      /util/lib/cmake/boost_system-1.70.0/boost_system-config.cmake

      but it set boost_system_FOUND to FALSE so package "boost_system" is considered to be NOT FOUND.
      Reason given by package:
      No suitable build variant has been found.
Call Stack (most recent call first):
   /util/lib/cmake/Boost-1.70.0/BoostConfig.cmake:89 (boost_find_dependency)
   /util/share/cmake-3.7/Modules/FindBoost.cmake:229 (find_package)
 CMakeLists.txt:4 (find_package)

I tried to set Boost_USE_STATIC_LIBS option but the error still remains.

Can this be a version conflict in Boost.System or not? What should I do to avoid this error? It is not possible to remove Boost from project, so I can not accept an answer about such removal...


Solution

  • I investigated the history of changes in Boost, so the answer is that building dependencies in projects linking Boost should be manually included into CMake (see answers here: CMake finds Boost but the imported targets not available for Boost version for details). Thus it is mandatory to use Boost version that is slightly older than CMake version you use. I solved my problem with rollback to Boost 1.61 (according to peculiarities of my embedded platform I can not compile CMake version above 3.7.0).