[boost-test] unable to find using cmake, but vcpkg installed it
@Mengna-Li is already working on this.
Since Mar 12, 2025.
- Dominant language
- CMake
- Stars
- 27.5k
- Forks
- 7.7k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 321
Description
Describe the bug
I'm using vcpkg in CMake on Windows in Visual Studio Code (to build a C++/Python library using Boost.Python). In my vcpkg.json I have
{
"dependencies": [
{
"name": "python3",
"features": ["extensions"]
},
"gmp",
"mpfr",
"mpc",
"boost-log",
"boost-multiprecision",
"boost-serialization",
"boost-test",
"boost-filesystem",
"boost-python",
"eigen3"
]
}
Running the CMake: Configure project successfully installs my requirements, telling me (excerpted to focus on boost-test):
[cmake] The package boost-test is compatible with built-in CMake targets of FindBoost.cmake:
[cmake]
[cmake] find_package(Boost REQUIRED COMPONENTS test)
[cmake] target_link_libraries(main PRIVATE Boost::test)
[cmake]
[cmake] or the generated cmake configs via:
[cmake]
[cmake] find_package(boost_test REQUIRED CONFIG)
[cmake] target_link_libraries(main PRIVATE Boost::test)
and then in CMake, I do find_package to find the things I requested from vcpkg, using either of the forms suggested. It finds my other requirements, but I can't get it to find boost-test, using either of the recommended lines, and I get the error:
[cmake] CMake Error at C:/Users/amethyst/repo/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package):
[cmake] Could not find a package configuration file provided by "boost_test"
[cmake] (requested version 1.87.0) with any of the following names:
[cmake]
[cmake] boost_testConfig.cmake
[cmake] boost_test-config.cmake
[cmake]
[cmake] Add the installation prefix of "boost_test" to CMAKE_PREFIX_PATH or set
[cmake] "boost_test_DIR" to a directory containing one of the above files. If
[cmake] "boost_test" provides a separate development package or SDK, be sure it has
[cmake] been installed.
[cmake] Call Stack (most recent call first):
[cmake] out/build/x64-debug/vcpkg_installed/x64-windows/share/boost/BoostConfig.cmake:67 (find_package)
[cmake] out/build/x64-debug/vcpkg_installed/x64-windows/share/boost/BoostConfig.cmake:128 (boostcfg_find_component)
[cmake] out/build/x64-debug/vcpkg_installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:3 (_find_package)
[cmake] C:/Users/amethyst/repo/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
[cmake] C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.30/Modules/FindBoost.cmake:610 (find_package)
[cmake] out/build/x64-debug/vcpkg_installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:3 (_find_package)
[cmake] C:/Users/amethyst/repo/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
[cmake] core/CMakeLists.txt:63 (find_package)
Looking in the directory where the other .cmake files are for boost components, I see none for boost_test. BUT, I do see one for boost_unit_test_framework, which is what I was kinda expecting since I am adapting my project from MacOS/Linux to Windows, and previously was looking for boost_unit_test_framework.
So, I suspect that the output from vcpkg telling me how to find boost-test are incorrect.
Indeed, I can find by using
find_package(Boost REQUIRED COMPONENTS unit_test_framework)
which is how I was finding it before.
Environment
- OS: Windows
- Compiler: revision
To Reproduce
Steps to reproduce the behavior:
- CMake Configure for a project in Visual Studio
- ask for
"boost-test",invcpkg.json - use a vcpkg recommended cmake line to try to find boost-test: either
find_package(Boost REQUIRED COMPONENTS test)orfind_package(boost_test REQUIRED CONFIG)to try to find - Run CMake Configure
- Error
Expected behavior
If I find boost-test from vcpkg, the way it tells me to find that package in cmake should match and be usable.
Failure logs
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.