A small note about static linking Boost, so as not to forget.
Initial data:
- OS Windows
- MSVC 2017 64bit
- Boost 1.68.0
- CMake project
Step 1
Скачиваем boost библиотеку и куда-нибудь её распаковываем. Место распаковки не принципиально.
Step 2
We only carry out two commands to the unpacking boost directory.
To build the engine
bootstrap.bat vc141
To build and install libraries directly
.\b2 toolset=msvc-14.1 --address-model=64 --link=static --variant=debug --variant=release stage install
In this case, a static build of the boost in the release and debug versions will be performed.
All files will be copied to the following directory.
C:\Boost
Step 3
Configuration of CMakeLists.txt
cmake_minimum_required (VERSION 3.8) project(MyProject) set(CMAKE_CXX_STANDARD 17) set(Boost_USE_STATIC_LIBS ON) find_package(Boost 1.68 COMPONENTS program_options) set(SOURCE_FILES main.cpp App.cpp App.h) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) add_executable(MyProject${SOURCE_FILES}) target_link_libraries(MyProject${Boost_LIBRARIES}) endif()