简体   繁体   中英

vcpkg toolchain on linux

I just wonder how you can know how to properly case the libraries in vcpkg? ie

find_package(gtest REQUIRED) will fail but

find_package(GTest REQUIRED) will pass

What I mean is if I list the installed packages I get them in lowercase letters, ie

CMake suite maintained and supported by Kitware (kitware.com/cmake).
~/Proj$ cd vcpkg
~/Proj/vcpkg$ ./vcpkg list
fftw3:x64-linux                                    3.3.10#3         FFTW is a C subroutine library for computing the...
gtest:x64-linux                                    1.11.0#3         GoogleTest and GoogleMock testing frameworks
vcpkg-cmake-config:x64-linux                       2021-12-28
vcpkg-cmake:x64-linux                              2021-12-20

So if I for instance want to add fftw3, how can I tell which case it is?

find_package(fftw3 REQUIRED) fails...

Assuming you are correctly adding -DCMAKE_TOOLCHAIN_FILE=$HOME/Proj/vcpkg/scripts/buildsystems/vcpkg.cmake to your build, then what you're observing has nothing to do with vcpkg in particular.

find_package is as case-sensitive as the filesystem you're on. On Windows, gtest will happen to work, but the real name is GTest , so only that one works on Linux. The name of the fftw3 package is, similarly, FFTW3 .

Vcpkg very helpfully tells you this, too:

$ ./vcpkg install fftw3:x64-linux
...
The package fftw3 provides CMake targets:

    find_package(FFTW3 CONFIG REQUIRED)
    target_link_libraries(main PRIVATE FFTW3::fftw3)

    find_package(FFTW3f CONFIG REQUIRED)
    target_link_libraries(main PRIVATE FFTW3::fftw3f)

    find_package(FFTW3l CONFIG REQUIRED)
    target_link_libraries(main PRIVATE FFTW3::fftw3l)
$ ./vcpkg install gtest:x64-linux
...
The package gtest provides CMake targets:

    find_package(GTest CONFIG REQUIRED)
    target_link_libraries(main PRIVATE GTest::gmock GTest::gtest GTest::gmock_main GTest::gtest_main)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM