Add this to your CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
my_cool_package
GIT_REPOSITORY https://github.com/yiftahw-fsr/my_cool_package.git
GIT_TAG dev # or specify a commit hash/tag
)
FetchContent_MakeAvailable(my_cool_package)
# Link against your target
target_link_libraries(my_app PRIVATE my_cool_package)Alternatively, if you're using CPM.cmake:
include(cmake/CPM.cmake)
CPMAddPackage(
NAME my_cool_package
GITHUB_REPOSITORY yiftahw-fsr/my_cool_package
GIT_TAG dev # or specify a commit hash/tag
)
# Link against your target
target_link_libraries(my_app PRIVATE my_cool_package)Note: there is no need to add include_directories or target_include_directories as the package handles that for you.