cmake_minimum_required(VERSION 4.1)
project(basic-vcs)

include(FetchContent)
FetchContent_Declare(ZStrGitRepo
        GIT_REPOSITORY    "https://github.com/mateidavid/zstr" # can also be a local filesystem path!
        GIT_TAG           "master"
)
FetchContent_MakeAvailable(ZStrGitRepo) # defines INTERFACE target 'zstr::zstr'

set(BUILD_TZ_LIB ON)# timezone support

FetchContent_Declare( date_src
        GIT_REPOSITORY https://gitlab.com/JosephA1997/date.git
        GIT_TAG        "master"
)
FetchContent_MakeAvailable(date_src)

set(CMAKE_CXX_STANDARD 23)

add_executable(basic-vcs src/main.cpp
        include/sha1.hpp
        include/init.h
        include/cat-file.h
        include/commands.h
        include/ls-tree.h
        include/write-tree.h
        src/commands/cat-file.cpp
        src/commands/init.cpp
        src/commands/ls-tree.cpp
        src/commands/write-tree.cpp
        src/commands/hash-object.cpp
        include/hash-object.h
        src/commands/commit-tree.cpp
        include/commit-tree.h
        include/commit-tree.h)

target_link_libraries(basic-vcs PRIVATE zstr::zstr date::date date::date-tz)
target_include_directories(basic-vcs PRIVATE include)