cmake_minimum_required(VERSION 3.20)

project(
    imgui
    VERSION 1.91.8
    DESCRIPTION "imgui v1.91.8-docking"
    LANGUAGES CXX
)

message(STATUS "Build Dear ImGui: ${PROJECT_VERSION}")

add_library(
    imgui
    # Core
    src/imgui.cpp
    src/imgui_stdlib.cpp
    src/imgui_tables.cpp
    src/imgui_demo.cpp
    src/imgui_draw.cpp
    src/imgui_widgets.cpp
    # Backends
    src/imgui_impl_glfw.cpp
    src/imgui_impl_opengl3.cpp
    # Miscellaneous
    src/misc/freetype/imgui_freetype.cpp
)

target_compile_definitions(imgui PUBLIC IMGUI_ENABLE_FREETYPE)
target_include_directories(imgui PUBLIC "include/")

# GLFW (this feels kinda hacky, OVERRIDE_FIND_PACKAGE'd in the parent CMakeLists.txt)
find_package(glfw 3.4 REQUIRED)
# ditto FreeType
find_package(freetype REQUIRED)

target_link_libraries(imgui PRIVATE glfw freetype)
target_include_directories(imgui PRIVATE glfw)
