CMake: Using Boost v1.69 with MSVC on Windows

cmake findboost
boost windows
including boost with cmake
compile boost windows
install boost 1.70 windows
boost visual studio 2015
boost python cmake
boost 1.69 download

I'm trying to use the Boost library in my C++ project on Windows using CLion and MinGWMSVC. I downloaded the precompiled binaries here and extracted everything to C:\local\boost_1_69_0_b1_rc3. I setup the following CMakeLists.txt:

cmake_minimum_required(VERSION 3.11.4)
project(BoostTesting)

set(CMAKE_CXX_STANDARD 17)

set(BOOST_ROOT "C:/local/boost_1_69_0_b1_rc3")
set(BOOST_LIBRARYDIR "C:/local/boost_1_69_0_b1_rc3/lib64-msvc-14.1")
set(BOOST_INCLUDEDIR "C:/local/boost_1_69_0_b1_rc3/boost")

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(Boost_DEBUG ON)
set(Boost_DETAILED_FAILURE_MSG ON)
set(Boost_COMPILER "-vc141")
set(Boost_ARCHITECTURE "-x64")

find_package(Boost 1.69.0 COMPONENTS filesystem REQUIRED)

if (Boost_FOUND)
    include_directories(${Boost_INCLUDE_DIRS})
    add_executable(BoostTesting main.cpp)
    target_link_libraries(BoostTesting ${Boost_LIBRARIES})
endif ()

Using CMake's FindBoost debug mode (Boost_DEBUG) I got the following output:

C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\183.4284.104\bin\cmake\win\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/mingw32-make.exe" "-DCMAKE_C_COMPILER=C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-gcc.exe" "-DCMAKE_CXX_COMPILER=C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-g++.exe" -G "CodeBlocks - MinGW Makefiles" D:\Cpp\BoostTesting
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-gcc.exe
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-g++.exe
-- Check for working CXX compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:18 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Environment variable Boost_ROOT is set to:

    C:\local\boost_1_68_0\boost

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1125 ] _boost_TEST_VERSIONS = 
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1127 ] Boost_USE_MULTITHREADED = ON
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1129 ] Boost_USE_STATIC_LIBS = ON
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1131 ] Boost_USE_STATIC_RUNTIME = OFF
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1133 ] Boost_ADDITIONAL_VERSIONS = 
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1135 ] Boost_NO_SYSTEM_PATHS = 
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1203 ] Declared as CMake or Environmental Variables:
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1205 ]   BOOST_ROOT = C:/local/boost_1_69_0_b1_rc3
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1207 ]   BOOST_INCLUDEDIR = C:/local/boost_1_69_0_b1_rc3/boost
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1209 ]   BOOST_LIBRARYDIR = C:/local/boost_1_69_0_b1_rc3/lib64-msvc-14.1
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1211 ] _boost_TEST_VERSIONS = 
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1286 ] Include debugging info:
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1288 ]   _boost_INCLUDE_SEARCH_DIRS = C:/local/boost_1_69_0_b1_rc3/boost;C:/local/boost_1_69_0_b1_rc3/include;C:/local/boost_1_69_0_b1_rc3;PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1290 ]   _boost_PATH_SUFFIXES = 
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1310 ] location of version.hpp: C:/local/boost_1_69_0_b1_rc3/boost/version.hpp
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1334 ] version.hpp reveals boost 1.69.0
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1410 ] using user-specified Boost_COMPILER = -vc141
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1430 ] _boost_MULTITHREADED = -mt
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1506 ] _boost_RELEASE_ABI_TAG = -
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1508 ] _boost_DEBUG_ABI_TAG = -d
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1571 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/local/boost_1_69_0_b1_rc3/lib64-msvc-14.1;C:/local/boost_1_69_0_b1_rc3/lib;C:/local/boost_1_69_0_b1_rc3/stage/lib;C:/local/boost_1_69_0_b1_rc3/lib;C:/local/boost_1_69_0_b1_rc3/../lib;C:/local/boost_1_69_0_b1_rc3/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG   = C:/local/boost_1_69_0_b1_rc3/lib64-msvc-14.1;C:/local/boost_1_69_0_b1_rc3/lib;C:/local/boost_1_69_0_b1_rc3/stage/lib;C:/local/boost_1_69_0_b1_rc3/lib;C:/local/boost_1_69_0_b1_rc3/../lib;C:/local/boost_1_69_0_b1_rc3/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
CMake Warning at C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:18 (find_package)


CMake Warning at C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
  C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:18 (find_package)


-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1760 ] Searching for FILESYSTEM_LIBRARY_RELEASE: libboost_filesystem-vc141-mt-1_69;libboost_filesystem-vc141-mt;libboost_filesystem-mt-1_69;libboost_filesystem-mt;libboost_filesystem
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1813 ] Searching for FILESYSTEM_LIBRARY_DEBUG: libboost_filesystem-vc141-mt-d-1_69;libboost_filesystem-vc141-mt-d;libboost_filesystem-mt-d-1_69;libboost_filesystem-mt-d;libboost_filesystem-mt;libboost_filesystem
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1760 ] Searching for SYSTEM_LIBRARY_RELEASE: libboost_system-vc141-mt-1_69;libboost_system-vc141-mt;libboost_system-mt-1_69;libboost_system-mt;libboost_system
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1813 ] Searching for SYSTEM_LIBRARY_DEBUG: libboost_system-vc141-mt-d-1_69;libboost_system-vc141-mt-d;libboost_system-mt-d-1_69;libboost_system-mt-d;libboost_system-mt;libboost_system
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1887 ] Boost_FOUND = 1
CMake Error at C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:2048 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.69.0

  Boost include path: C:/local/boost_1_69_0_b1_rc3

  Could not find the following static Boost libraries:

          boost_filesystem

  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.
Call Stack (most recent call first):
  CMakeLists.txt:18 (find_package)


-- Configuring incomplete, errors occurred!
See also "D:/Cpp/BoostTesting/cmake-build-debug/CMakeFiles/CMakeOutput.log".

[Failed to reload]

CMake is looking for those specific files but I noticed that the -x64 indication is not part of the searched file names. My directory only contains 64-bit libraries:

Why is the Boost_ARCHITECTURE environment variable ignored? I expect it to add the missing -x64 to the searched file names. If I manually rename the libboost_filesystem-vc141-mt*.lib files they can be found by CMake. However, if I compile and link my simple main.cpp I'm getting a linker error:

====================[ Build | BoostTesting | Debug ]============================
C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\183.4284.104\bin\cmake\win\bin\cmake.exe --build D:\Cpp\BoostTesting\cmake-build-debug --target BoostTesting -- -j 4
Scanning dependencies of target BoostTesting
[ 50%] Building CXX object CMakeFiles/BoostTesting.dir/main.cpp.obj
[100%] Linking CXX executable BoostTesting.exe
CMakeFiles\BoostTesting.dir/objects.a(main.cpp.obj): In function `boost::filesystem::path_traits::convert(char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)':
C:/local/boost_1_69_0_b1_rc3/boost/filesystem/path.hpp:997: undefined reference to `boost::filesystem::path::codecvt()'
C:/local/boost_1_69_0_b1_rc3/boost/filesystem/path.hpp:997: undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\BoostTesting.dir/objects.a(main.cpp.obj): In function `boost::filesystem::file_size(boost::filesystem::path const&)':
C:/local/boost_1_69_0_b1_rc3/boost/filesystem/operations.hpp:616: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\BoostTesting.dir\build.make:88: BoostTesting.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:72: CMakeFiles/BoostTesting.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:84: CMakeFiles/BoostTesting.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: BoostTesting] Error 2

main.cpp source code:

#include <iostream>
#include <boost/filesystem.hpp>

using namespace boost::filesystem;

int main(int argc, char *argv[]) {
    if (argc < 2) {
        std::cout << "Usage: tut1 path\n";
        return 1;
    }
    std::cout << argv[1] << " " << file_size(argv[1]) << '\n';
    return 0;
}

I'm pretty sure renaming the files is not the proper way of doing it. But even this way it doesn't work. What am I doing wrong and how do you properly use Boost in a simple C++ project like this one?

  1. You got CMake warning

    New Boost version may have incorrect or missing dependencies and imported targets

    because that CMake version does not prepared for boost 1.69 (Maybe latest CMake does...). So CMake tries its best to recognize that version, so it still may work (see point 3 below).

  2. @Felix Natter correctly pointed out above that Boost_ARCHITECTURE is handled only from CMake 3.13.

  3. You can make it work without manual renaming, without GCC or MINGW, if you rebuild your boost with one of the file naming "layouts", your CMake recognizes. (From your debug log these ones:

    libboost_<module name>-<toolset>[-mt]-<ABI tag>-<boost version> libboost_<module name>-<toolset>[-mt]-<ABI tag> libboost_<module name>[-mt]-<ABI tag>-<boost version> libboost_<module name>[-mt] libboost_<module name>)

    Unfortunately only the system layout matches, which means you need to separate Debug and Release builds in different "lib" folders. For explanation about the "layout" parameter see here.

    So rebuild boost by specifying the --layout=system parameter, and also decide the variant by specifying variant=debug or variant=release.

    As a starting point, on SF you can find the build log file: https://sourceforge.net/projects/boost/files/boost-binaries/1.69.0/boost_1_69_0-64bitlog.txt/download The last build "entry" in the file is for vc141, which is your version: b2 -j%NUMBER_OF_PROCESSORS% --without-mpi --build-type=complete toolset=msvc-14.1 address-model=64 architecture=x86 --prefix=.\ --libdir=lib64-msvc-14.1 --includedir=garbage_headers install

    Go to your boost source root and do > bootstrap first. Make sure msvc-14.1 was detected.

    Now build: > b2 -a -j%NUMBER_OF_PROCESSORS% --without-mpi --with-filesystem toolset=msvc-14.1 address-model=64 architecture=x86 variant=debug --layout=system --prefix=C:\boost_build\debug

    Do it for Release in a different target directory. Change --prefix according to your needs. You may also specify --libdir and --includedir if the default is not good for you. Of course, probably you need to modify your CMakeList file so that it can use both the Debug and Release variants...

So the best is to use a CMake version, which recognizes boost ver 1.69, and/or get a CMake-based version of boost, which includes 1.69.

cmake FindBoost not finding Boost libraries when building with , However, when using cmake to build MinGW on Windows , I get the following error Boost version: 1.69.0 The tag was added to handle Boost 1.66.0 and later versions. libboost_system-mgw73-mt-d-x64-1_69.a as FindBoost.​cmake does not read Boost_ARCHITECTURE as an environment variable  Boost - static linking in CMake project under Windows. 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 An exampl

I believe find_package(Boost ...) has failed in your case as it won't be able to find the REQUIRED filesystem library for 64-bit GCC.

Make sure you have the GCC build of Boost available as well, because now you're only showing the V++ libraries.

[boost] 1.69 problem with cmake_paths · Issue #171 · conan , cmake_paths generator does not work correctly on Windows I am very install latest cmake; install visual studio 2017 build tools; install python & conan Failed example using boost/1.69 (notice the lib prefix on the libraries): cmake_paths generator does not work correctly on Windows. I am very interested in the transparent cmake integration that the cmake_paths generator provides. For the boost/1.6{4-8}@conan/stable packages using the cmake_paths generator and simply including the Boost components using find_package(Boost COMPONENTS system ..

set(Boost_ARCHITECTURE "-x64")

only works with cmake >= 3.13 [1] [2]. If you cannot upgrade to cmake 3.13+, you can work around with:

set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID, "x64")

(not sure under what conditions this is set automatically)

[1] https://cmake.org/cmake/help/v3.12/module/FindBoost.html [2] https://cmake.org/cmake/help/v3.13/module/FindBoost.html

[boost] Cannot statically link with CMake and Visual Studio · Issue , Using Visual Studio 2015 and CMake 3.13.2 (the only versions I currently have find_package(Boost 1.69 EXACT REQUIRED COMPONENTS Cmake not finding static boost lib from conan package on Windows #4307. Using CMake to build a cross-platform project with a Boost dependency. Jul 30, 2012 • While working on the test suite for C++11 Rocks, I needed to setup a cross-platform test suite based on Boost.Test for code examples. I decided to go with CMake for build management because it seems to be a fairly popular option.

It turns out it works when using the MinGW distribution with built-in Boost.

CMakeLists.txt:

cmake_minimum_required(VERSION 3.11.4)
project(BoostTesting)

set(CMAKE_CXX_STANDARD 17)

if(WIN32)
    set(BOOST_ROOT "C:/MinGW")
endif ()

find_package(Boost 1.67.0 COMPONENTS filesystem REQUIRED)

if (Boost_FOUND)
    include_directories(${Boost_INCLUDE_DIRS})
    add_executable(BoostTesting main.cpp)
    target_link_libraries(BoostTesting ${Boost_LIBRARIES})
endif ()

main.cpp output:

D:\Cpp\BoostTesting\cmake-build-debug\BoostTesting.exe
Usage: tut1 path

Process finished with exit code 1

It compiled and linked successfully.

Boost Getting Started on Windows - 1.69.0, 1 Get Boost; 2 The Boost Distribution; 3 Header-Only Libraries; 4 Build a Simple Program Using Boost. 4.1 Build From the Visual Studio IDE; 4.2 Or, Build From  It is an issue with the _boost_ARCHITECTURE_TAG in FindBoost.cmake, described on line 1518. The tag was added to handle Boost 1.66.0 and later versions. It is not setting the _boost_ARCHITECTURE_TAG for MinGW to -x64, so it is searching for boost library names like:

FindBoost, Use this module by invoking find_package with the form: of version components (3) Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) - Pass to linking with MSVC (adds BOOST_ALL_NO_LIB) Boost::dynamic_linking - interface target to  SET (BOOST_ROOT "c:/Boost") SET (BOOST_INCLUDEDIR "c:/Boost/boost") SET (BOOST_LIBRARYDIR "c:/Boost/libs") FIND_PACKAGE(Boost 1.68.0 REQUIRED COMPONENTS filesystem) c++ windows boost cmake boost-filesystem. share. Share a link to this question. Copy link.

HPX build system, If you use Visual Studio "NMake Makefiles" is a generator you can use for building with CMake will use default values for all build parameters. Any Windows system HPX currently requires at least Boost V1.61.0 to work properly​. wget https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.​bz2 tar xjf  Adapting @MOnsDaR answer for modern CMake syntax with imported targets, this would be: find_package(Boost 1.40 COMPONENTS program_options REQUIRED)add_executable(anyExecutable myMain.cpp)target_link_libraries(anyExecutable Boost::program_options)

Modules/FindBoost.cmake · master · CMake / CMake · GitLab, This module first searches for the ``Boost`` header files using the above hint to specify whether to use libraries linked statically to the C++ runtime ('s' tag). tag in Boost 1.69+ library naming. if(CMAKE_CXX_COMPILER_ID http://boost.org/​doc/libs/1_66_0/more/getting_started/windows.html#library-  That's because the BOOST_LIBRARYDIR is defined as ` BOOST_LIBRARYDIR - Preferred library directory e.g. <prefix>/lib` and ` BOOST_ROOT (or BOOSTROOT) - Preferred installation prefix ` That is, your Boost installation's library dir is prefix/lib64-msvc-12.0 not prefix/lib as the FindPackage will try to find – bitek Feb 14 '17 at 7:45

Comments
  • Apparently the key was to just use a newer CMake version.
  • There are no GCC compiled binaries for Windows and I just want to use the provided MSVC libraries. Isn't that possible?
  • @BullyWiiPlaza I am pretty sure you need to compile boost using mingw. Thankfully its not difficult to build boost.
  • @BullyWiiPlaza You'll need to build it. GCC and MSVC are not ABI compatible.