Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[boost-test] unable to find using cmake, but vcpkg installed it #44308

Open
ofloveandhate opened this issue Mar 11, 2025 · 1 comment
Open

[boost-test] unable to find using cmake, but vcpkg installed it #44308

ofloveandhate opened this issue Mar 11, 2025 · 1 comment
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@ofloveandhate
Copy link

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:

  1. CMake Configure for a project in Visual Studio
  2. ask for "boost-test", in vcpkg.json
  3. use a vcpkg recommended cmake line to try to find boost-test: either find_package(Boost REQUIRED COMPONENTS test) or find_package(boost_test REQUIRED CONFIG) to try to find
  4. Run CMake Configure
  5. 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

@Mengna-Li Mengna-Li added the category:port-bug The issue is with a library, which is something the port should already support label Mar 12, 2025
@Mengna-Li
Copy link
Contributor

Confirmed, I can repro this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

No branches or pull requests

2 participants