cmake_minimum_required(VERSION 3.20)
project(OpenGLProject)

# Set C++ standard (using 17 for stability, as 26 is still very new)
set(CMAKE_CXX_STANDARD 17)

# 1. Tell CMake to look for headers in your local 'include' folder
include_directories(include)

# 2. Locate the necessary libraries on Fedora
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLFW REQUIRED glfw3)
find_package(OpenGL REQUIRED)

# 3. Add your source files (including glad.c!)
add_executable(OpenGLProject main.cpp glad.c)

# 4. Link everything together
# ${GLFW_LIBRARIES} handles -lglfw
# ${OPENGL_LIBRARIES} handles -lGL
# dl is for the dynamic loader (required for GLAD)
target_link_libraries(OpenGLProject
        ${GLFW_LIBRARIES}
        ${OPENGL_LIBRARIES}
        dl
)