1 | git clone https://github.com/microsoft/vcpkg |
vcpkg在Windows中默认编译并安装x86版本的库。 若要编译并安装x64版本,请执行:
1 | .\vcpkg\vcpkg install [package name]:x64-windows |
当您希望将vcpkg作为一个子模块加入到您的工程中时, 您可以在第一个
project() 调用之前将以下内容添加到 CMakeLists.txt 中, 而无需将
CMAKE_TOOLCHAIN_FILE 传递给cmake调用。 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15if(WIN32)
set(CMAKE_TOOLCHAIN_FILE C:/Software/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
endif()
cmake_minimum_required(VERSION 3.22)
project(yijinjing)
set(CMAKE_CXX_STANDARD 23)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE(Boost COMPONENTS filesystem system thread regex REQUIRED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
message(${Boost_INCLUDE_DIRS})