lfreist / hwinfo

cross platform C++ library for hardware information (CPU, RAM, GPU, ...)
MIT License
433 stars 74 forks source link

Can you provide Findhwconfig.cmake for ease of use with CMake? #74

Closed pauljurczak closed 4 weeks ago

pauljurczak commented 8 months ago

I would like to be able to use the standard find_package(hwconfig REQUIRED) in CMakeLists.txt. Could you provide it? This could also solve the problem of having to install hwinfo inside the project directory for each project.

lfreist commented 4 weeks ago

@pauljurczak 994b1bf1fab4e8f72a1d5418f1bf19d3ddd6bafe adds CMake install targets. Once built and installed using CMake, you can use find_package(hwinfo):

mkdir build
cmake --build build
cmake --install build

In your CMakeLists.txt, add:

find_package(hwinfo REQUIRED)

And link it against your target:

target_link_library(target PRIVATE hwinfo::hwinfo)