Как мне найти Boost date_time в CMake с помощью vcpkg?C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Как мне найти Boost date_time в CMake с помощью vcpkg?

Сообщение Anonymous »

У меня установлен vcpkg 2025-09-03 и установлен CMake 4.1.2.
Теперь я хочу установить Boost Date-Time
.\vcpkg.exe install boost-date-time

И проверьте, установлен ли boost-date-time.
PS C:\Users\negrå\Documents\GitHub\vcpkg> . \ v c p k g . e x e l i s t < b r / > a b s e i l : x 6 4 - w i n d o w s 2 0 2 5 0 5 1 2 . 1 A b s e i l i s a n o p e n - s o u r c e c o l l e c t i o n o f C + + l i b r a . . . < b r / > b o o s t - a l g o r i t h m : x 6 4 - w i n d o w s 1 . 8 9 . 0 B o o s t a l g o r i t h m m o d u l e < b r / > b o o s t - a l i g n : x 6 4 - w i n d o w s 1 . 8 9 . 0 B o o s t a l i g n m o d u l e < b r / > b o o s t - a r r a y : x 6 4 - w i n d o w s 1 . 8 9 . 0 B o o s t a r r a y m o d u l e < b r / > b o o s t - a s s e r t : x 6 4 - w i n d o w s 1 . 8 9 . 0 B o o s t a s s e r t m o d u l e < b r />boost-atomic:x64-windows 1.89.0 Boost atomic module
boost-bind:x64-windows 1.89.0 Boost bind module
boost-cmake:x64-windows 1.89.0 Boost cmake module
boost-concept-check:x64-windows 1.89.0 Boost concept_check module
boost-config:x64-windows 1.89.0 Boost config module
boost-container-hash:x64-windows 1.89.0 Boost container_hash module
boost-container:x64-windows 1.89.0 Boost container module
boost-conversion:x64-windows 1.89.0 Boost conversion module
boost-core:x64-windows 1.89.0 Boost core module
boost-date-time:x64-windows 1.89.0 Boost date_time module
boost-describe:x64-windows 1.89.0 Boost describe module
boost-detail:x64-windows 1.89.0 Boost detail module
boost-exception:x64-windows 1.89.0 Boost exception module
boost-filesystem:x64-windows 1.89.0 Boost filesystem module
boost-function-types:x64-windows 1.89.0 Boost function_types module
boost-function:x64-windows 1.89.0 Boost function module
boost-functional:x64-windows 1.89.0 Boost functional module
boost-fusion:x64-windows 1.89.0 Boost fusion module
boost-headers:x64-windows 1.89.0 Boost headers module
boost-intrusive:x64-windows 1.89.0 Boost intrusive module
boost-io:x64-windows 1.89.0 Boost io module
boost-iterator:x64-windows 1.89.0 Boost iterator module
boost-lexical-cast:x64-windows 1.89.0 Boost lexical_cast module
boost-move:x64-windows 1.89.0 Boost move module
boost-mp11:x64-windows 1.89.0 Boost mp11 module
boost-mpl:x64-windows 1.89.0 Boost mpl module
boost-numeric-conversion:x64-windows 1.89.0 Boost numeric_conversion module
boost-optional:x64-windows 1.89.0 Boost optional module
boost-predef:x64-windows 1.89.0 Boost predef module
boost-preprocessor:x64-windows 1.89.0 Boost preprocessor module
boost-range:x64-windows 1.89.0 Boost range module
boost-regex:x64-windows 1.89.0 Boost regex module
boost-scope:x64-windows 1.89.0 Boost scope module
boost-smart-ptr:x64-windows 1.89.0 Boost smart_ptr module
boost-static-assert:x64-windows 1.89.0 Boost static_assert module
boost-system:x64-windows 1.89.0 Boost system module
boost-throw-exception:x64-windows 1.89.0 Boost throw_exception module
boost-tokenizer:x64-windows 1.89.0 Boost tokenizer module
boost-tuple:x64-windows 1.89.0 Boost tuple module
boost-type-traits:x64-windows 1.89.0 Boost type_traits module
boost-typeof:x64-windows 1.89.0 Boost typeof module
boost-uninstall:x64-windows 1.89.0 Internal vcpkg port used to uninstall Boost
boost-unordered:x64-windows 1.89.0 Boost unordered module
boost-utility:x64-windows 1.89.0 Boost utility module
boost-variant2:x64-windows 1.89.0 Boost variant2 module
boost-winapi:x64-windows 1.89.0 Boost winapi module

Когда я добавляю это в свой CMakeList.txt
find_package(Boost CONFIG REQUIRED COMPONENTS date_time)
if (Boost_FOUND)
message(STATUS "Boost date time library found")
target_link_libraries(GoobySoft PRIVATE Boost::date_time)
else()
message(FATAL_ERROR "Boost date time library not found")
endif()

Затем я запускаю cmake и vcpkg
C:\Users\negrå\Documents\GitHub\MicroSoft> cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=C:\\Users\\negrå\\Documents\\GitHub\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake

Я понимаю. Все остальное находит, кроме этого
CMake Error at C:/Users/negrå/Documents/GitHub/vcpkg/scripts/buildsystems/vcpkg.cmake:900 (_find_package):
Could not find a package configuration file provided by "boost_date_time"
(requested version 1.89.0) with any of the following names:

boost_date_timeConfig.cmake
boost_date_time-config.cmake

Add the installation prefix of "boost_date_time" to CMAKE_PREFIX_PATH or
set "boost_date_time_DIR" to a directory containing one of the above files.
If "boost_date_time" provides a separate development package or SDK, be
sure it has been installed.
Call Stack (most recent call first):
C:/Users/negrå/Documents/GitHub/vcpkg/installed/x64-windows/share/boost/BoostConfig.cmake:67 (find_package)
C:/Users/negrå/Documents/GitHub/vcpkg/installed/x64-windows/share/boost/BoostConfig.cmake:128 (boostcfg_find_component)
C:/Users/negrå/Documents/GitHub/vcpkg/installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:3 (_find_package)
C:/Users/negrå/Documents/GitHub/vcpkg/scripts/buildsystems/vcpkg.cmake:854 (include)
CMakeLists.txt:85 (find_package)

Вопрос
Что делать, если я получаю сообщение Не удалось найти файл конфигурации пакета, предоставленный "boost_date_time", и я устанавливаю boost-date-time с помощью vcpkg?
Изменить
Даже если я включу все библиотеки Boost, это не выдаст ошибок при построении кеша.
find_package(Boost CONFIG REQUIRED)
if (Boost_FOUND)
message(STATUS "Boost library found")
target_link_libraries(GoobySoft PRIVATE Boost)
else()
message(FATAL_ERROR "Boost library not found")
endif()

Ошибка все равно возникает
error C1083: Cannot open include file: 'boost/date_time/posix_time/posix_time.hpp':


Подробнее здесь: https://stackoverflow.com/questions/797 ... sing-vcpkg
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»