I have built Boost 1.68 (using instructions from https://gist.github.com/sim642/29caef3cc8afaa273ce6, and adding link=static,shared
to the b2 command line to also build shared libraries.)
The libraries appear to build correctly, and I have set the BOOST_INCLUDEDIR
and BOOST_LIBRARYDIR
environment variables correctly.
However, when I add the following to a CMakeLists.txt
:
find_package(Boost REQUIRED COMPONENTS system context coroutine thread random REQUIRED)
and generate with MinGW Makefiles
, I get the following error:
CMake Error at C:/Users/pbelanger/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/182.4129.15/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:2044 (message):
Unable to find the requested Boost libraries.
Boost version: 1.68.0
Boost include path: C:/boost/install/include/boost-1_68
Could not find the following static Boost libraries:
boost_system
boost_context
boost_coroutine
boost_thread
boost_random
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
I have placed the output of adding set(Boost_DEBUG ON)
before the find_package
line here: https://pastebin.com/yRd5DPt4
According to the debug output, the find script is searching in the correct directory (c:\boost\install\lib
), but is not finding the boost libraries since they have a different naming scheme. For example, the system
library is named libboost_system-mgw81-mt-x64-1_68.dll
, but the find script is passing he library name boost_system-mgw81-mt-1_68
to CMake's find_library
. Notice that the addressing model (-x64
)is not listed in the latter name.
My question is whether this is an issue with Boost, or the findCMake script? Can this be fixed by setting a specific cmake variable before the findCMake script?