I'm using the package manager vcpkg
to install the (static) Boost
libraries via vcpkg install boost:x64-windows-static
.
Furthermore, I use CMake
as my build system and I'm passing C:\vcpkg\scripts\buildsystems\vcpkg.cmake
to CMake
via the -DCMAKE_TOOLCHAIN_FILE
CMake
command.
In my CMakeLists.txt
I force static Boost
libraries:
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS filesystem iostreams REQUIRED)
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
endif ()
# ...
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
However, Visual Studio
still tries to look at the wrong file path for my Boost
libraries:
Error 'C:/vcpkg/installed/x64-windows/lib/boost_filesystem-vc140-mt.lib', needed by 'MyProject.exe', missing and no known rule to make it
If I install the dynamic Boost
libraries, it will build fine since this is where Visual Studio
looks. However, I want to use the static libraries in my build instead so that all DLL
s are "merged" into the final EXE
.
How can I accomplish this?