vcpkg icon indicating copy to clipboard operation
vcpkg copied to clipboard

[easyloggingpp] how to use it? (missing usage)

Open paulbuechner opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

When installing easyloggingpp via manifest mode:

{
    "name": "easyloggingpp",
    "version>=": "9.97.1",
    "features": [
      "no-defaultfile",
      "std-locking",
      "thread-safe"
    ]
},

...it states:

easyloggingpp provides pkg-config modules:

    # Feature-rich single header C++ logging library
    easyloggingpp

I'm missing instructions on how to "find" the library in CMake and how to link it.

Proposed solution

Add usage to port.

paulbuechner avatar Feb 13 '24 14:02 paulbuechner

https://cmake.org/cmake/help/latest/module/FindPkgConfig.html

find_package(PkgConfig REQUIRED) 
pkg_check_modules(easyloggingpp REQUIRED IMPORTED_TARGET easyloggingpp)
target_link_libraries(MyTarget PRIVATE PkgConfig::easyloggingpp)

Osyotr avatar Feb 13 '24 17:02 Osyotr

Actually i was missing the #include <easylogging++.cc> include to successfully compile, which is described here. Maybe we can state this in the usage file then.

Additionally checking if easyloggingpp is present with pkg_check_modules is a good way to prevent issues.

paulbuechner avatar Feb 14 '24 15:02 paulbuechner