PMM and VCPKG cannot find package directory

20 Views Asked by At

I'm trying out the pmm tool to add libraries to my project. I've opt'ed for the VCPKG variant. The pmm installs fine, packages are installed, but then the cmake command find_package(x), says it cannot find the package. After hours of fiddling around, I found where the packages are getting installed and manually added the path to cmake. This works, but of course it's very dissatisfying because I am not sure how universal this path would be. How can I make this work without providing that path? Or is this path always needed and I have not fully understood the documentation? Any insight would be much appreciated. Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)
project(pmmAndVcpkg VERSION 0.0.0)

set(VCPKG_REV 2022.05.10)

include(pmm.cmake)
pmm(
    VCPKG
    REVISION ${VCPKG_REV}
    REQUIRES fmt
)

# WHY DO I NEED THIS SECTION????
################################

set(VCPKG_PATH $ENV{HOME}/.local/share/pmm/${PMM_VERSION_INIT}/vcpkg-${VCPKG_REV}/packages)

set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${VCPKG_PATH} ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${VCPKG_PATH} ${CMAKE_PREFIX_PATH})
################################

find_package(fmt CONFIG REQUIRED)

add_executable(main main.cpp)

target_link_libraries(main PRIVATE fmt)

Apart from this file I only added the pmm.cmake file as required, and a main.cpp file to assert I can link to the library.

1

There are 1 best solutions below

0
AudioDroid On

I just had to add the triplet:

pmm(
    VCPKG
    REVISION ${VCPKG_REV}
    TRIPLET ${CMAKE_HOST_SYSTEM_PROCESSOR}-${PLATFORM}
    REQUIRES fmt
)