title: Could not find libgit2 in CMake
body: <p>I am doing my first steps in <code>CMake</code> and I have a Hello World example where I would like to use <a href="https://libgit2.org/" rel="nofollow noreferrer">libgit2</a>. My directory structure is the following:</p>
  <pre><code>- main.cpp
  - CMakeLists.txt
  - cmake/Modules/Findlibgit2.cmake
  - libs/libgit2/include/git2.h
  - libs/libgit2/debug/git/git2.lib
  - libs/libgit2/debug/git/git2.dll
  </code></pre>
  <p>I would like to link it either statically, or dynamically, at least it works for the beginning. But when I execute CMake, I receive the error message below. Could anyone help me with this?</p>
  <pre><code>Not searching for unused variables given on the command line.
  [cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
  [cmake]   Could NOT find libgit2 (missing: GIT2_LIBRARY GIT2_INCLUDE_PATH)
  [cmake] Call Stack (most recent call first):
  [cmake]   C:/Program Files/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
  [cmake]   cmake/Modules/Findlibgit2.cmake:15 (find_package_handle_standard_args)
  [cmake]   CMakeLists.txt:6 (find_package)
  </code></pre>
  <p><strong>Findlibgit2.cmake</strong></p>
  <pre><code># Find 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
  )
  </code></pre>
  <p><strong>CMakeLists.txt</strong></p>
  <pre><code>
  cmake_minimum_required(VERSION 2.8.9)
  project (backend)
  
  SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} &quot;${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/&quot;)
  find_package(libgit2 REQUIRED)
  
  include_directories(${LIBGIT2_INCLUDE_DIR})
  link_directories(&quot;backend/libs/libgit2/debug&quot;)
  add_executable(backend main.cpp)
  </code></pre>