winsiderss / phnt

Native API header files for the System Informer project.
https://github.com/winsiderss/systeminformer
MIT License
991 stars 166 forks source link

Add a CMakeLists.txt to allow FetchContent #19

Closed mrexodia closed 2 years ago

mrexodia commented 2 years ago

With this it becomes very easy to include phnt in a CMake-based project. If you add phnt a a submodule or vendor it in a different way:

add_subdirectory(third_party/phnt)

Download automatically during configuration:

include(FetchContent)

message(STATUS "Fetching phnt (cmake)...")
FetchContent_Declare(phnt
    GIT_REPOSITORY
        "https://github.com/mrexodia/phnt"
    GIT_TAG
        cmake
)
FetchContent_MakeAvailable(phnt)

In both cases you can link to phnt this way:

add_executable(native_example src/main.cpp)
target_link_libraries(native_example PRIVATE phnt::phnt) # or just phnt

If desired I can set up GitHub Actions that tests this.

dmex commented 2 years ago

LGTM 👍