I am working on simple minecraft launcher
https://github.com/skorakora/ZielonaAlkaidaLauncher
I would like to add libgit2 to it as git submodule.
I have tried
"git submodule add ``https://github.com/libgit2/libgit2`` extern/libgit2"
I also wrote CmakeLists.txt to add libgit2 to repo.
Cmake generates .sln fine but when I try to build project in visual studio it throws error:
LNK1104 cannot open file git2.lib
All I know for now there is something wrong with cmakelists.txt but I have no idea what is wrong.
My goal is to add libgit2 as git submodule to my repository
PS. Sorry for polish in comments and readme
I have tried to rewrite cmakelists.txt, but that did not helped
My Cmakelists.txt:
cmake_minimum_required(VERSION 3.15)
project(MinecraftLauncher)
set(CMAKE_CXX_STANDARD 17)
# GLFW jako submoduł
add_subdirectory(extern/glfw)
# IMGUI (ręczna konfiguracja)
file(GLOB IMGUI_SRC
extern/imgui/*.cpp
extern/imgui/backends/imgui_impl_glfw.cpp
extern/imgui/backends/imgui_impl_opengl3.cpp
)
add_library(imgui STATIC ${IMGUI_SRC})
target_include_directories(imgui PUBLIC
extern/imgui
extern/imgui/backends
)
target_link_libraries(imgui PUBLIC glfw)
# libgit2 jako submoduł (konfiguracja + dodanie)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libgit2" FORCE)
set(BUILD_CLAR OFF CACHE BOOL "Disable libgit2 tests" FORCE)
add_subdirectory(extern/libgit2)
# Główna aplikacja
add_executable(MinecraftLauncher main.cpp)
target_include_directories(MinecraftLauncher PRIVATE
extern/imgui
extern/imgui/backends
)
target_link_libraries(MinecraftLauncher PRIVATE
glfw
imgui
git2 # lub libgit2::git2 jeśli występuje jako alias
opengl32
)
libgit2packagelibrary target: github.com/libgit2/libgit2/blob/main/src/libgit2/…. So you need to link against this target intarget_link_librariescall.