From 32db3d78b14b8af58e92293e10512ba706206202 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 21 Mar 2023 17:24:24 +0100 Subject: [PATCH] (Unix) Added the libgit2 library as a dependency --- CMake/Packages/FindLibgit2.cmake | 25 +++++++++++++++++++++++++ CMakeLists.txt | 3 +++ 2 files changed, 28 insertions(+) create mode 100644 CMake/Packages/FindLibgit2.cmake diff --git a/CMake/Packages/FindLibgit2.cmake b/CMake/Packages/FindLibgit2.cmake new file mode 100644 index 000000000..108077b35 --- /dev/null +++ b/CMake/Packages/FindLibgit2.cmake @@ -0,0 +1,25 @@ +# Find the git2 library. +# +# GIT2_INCLUDE_DIRS - Where to find git2.h, etc. +# GIT2_LIBRARIES - List of libraries when using libgit2. +# GIT2_FOUND - True if libgit2 is found. + +# GIT2_INCLUDE_PATH +find_path(GIT2_INCLUDE_PATH NAMES git2.h) +# GIT2_LIBRARY +find_library(GIT2_LIBRARY NAMES git2) + +# Handle the QUIETLY and REQUIRED arguments and set GIT2_FOUND to TRUE if all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libgit2 REQUIRED_VARS GIT2_LIBRARY GIT2_INCLUDE_PATH) + +if(GIT2_FOUND) + set(GIT2_INCLUDE_DIR ${GIT2_INCLUDE_PATH}) + set(GIT2_INCLUDE_DIRS ${GIT2_INCLUDE_PATH}) + set(GIT2_LIBRARIES ${GIT2_LIBRARY}) +endif() + +mark_as_advanced( + GIT2_INCLUDE_PATH + GIT2_LIBRARY +) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 1410a09bf..f7b5b0fd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,6 +134,7 @@ elseif(NOT EMSCRIPTEN) find_package(FFmpeg REQUIRED) find_package(FreeImage REQUIRED) find_package(Freetype REQUIRED) + find_package(Libgit2 REQUIRED) find_package(Pugixml REQUIRED) find_package(SDL2 REQUIRED) endif() @@ -451,6 +452,7 @@ else() ${FFMPEG_INCLUDE_DIRS} ${FreeImage_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS} + ${GIT2_INCLUDE_PATH} ${PUGIXML_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR}) endif() @@ -563,6 +565,7 @@ else() ${FFMPEG_LIBRARIES} ${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES} + ${GIT2_LIBRARY} ${PUGIXML_LIBRARIES} ${SDL2_LIBRARY}) endif()