cmake_minimum_required(VERSION 3.16)

#USE THIS TO SET THE NAME
set(APP_NAME "Render_Template")

project(${APP_NAME} C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

include(FetchContent)

# Make FetchContent chatty so you see progress
set(FETCHCONTENT_QUIET OFF)
set(FETCHCONTENT_UPDATES_DISCONNECTED ON) # don’t re-fetch if already present

# Raylib build toggles
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_GAMES    OFF CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)

# Preferred: tag 5.5 via tarball (fast, reproducible)
FetchContent_Declare(
  raylib
  URL https://github.com/raysan5/raylib/archive/refs/tags/5.5.tar.gz
  # Optional but recommended: add URL_HASH once you compute it with sha256sum
  # URL_HASH SHA256=<paste hash here>
)

# Alternative: git (comment the URL block above and use this instead)
# FetchContent_Declare(
#   raylib
#   GIT_REPOSITORY https://github.com/raysan5/raylib.git
#   GIT_TAG 5.5
#   GIT_SHALLOW TRUE
# )

FetchContent_MakeAvailable(raylib)

add_executable(${APP_NAME}
  src/main.c
  src/raygui_impl.c
)

target_link_libraries(${APP_NAME} PRIVATE raylib)
target_include_directories(${APP_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include)

if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
  target_compile_options(${APP_NAME} PRIVATE -Wall -Wextra -Wpedantic)
endif()