2023-07-23 16:46:30 +02:00
|
|
|
cmake_minimum_required(VERSION 3.27)
|
2023-07-23 18:21:44 +02:00
|
|
|
project(HelloOpenGL)
|
2023-07-23 16:46:30 +02:00
|
|
|
|
2023-07-23 17:46:53 +02:00
|
|
|
# Define platform-specific paths and libraries
|
|
|
|
if(WIN32)
|
2023-07-23 18:21:44 +02:00
|
|
|
# GLFW
|
2023-07-23 17:46:53 +02:00
|
|
|
set(GLFW_PATH "C:/libs/glfw-3.3.8.bin.WIN64")
|
|
|
|
include_directories(${GLFW_PATH}/include)
|
|
|
|
link_directories(${GLFW_PATH}/lib-vc2022)
|
2023-07-23 18:21:44 +02:00
|
|
|
|
|
|
|
# OpenGL
|
|
|
|
find_package(OpenGL REQUIRED)
|
2023-07-23 17:46:53 +02:00
|
|
|
elseif(UNIX OR APPLE)
|
|
|
|
message(FATAL_ERROR "Linux and macOS platforms are not supported yet.")
|
|
|
|
endif()
|
2023-07-23 16:46:30 +02:00
|
|
|
|
2023-07-23 17:46:53 +02:00
|
|
|
add_executable(${PROJECT_NAME} hello.cpp)
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
target_link_libraries(${PROJECT_NAME} glfw3)
|
2023-07-23 18:21:44 +02:00
|
|
|
target_link_libraries(${PROJECT_NAME} OpenGL::GL)
|
2023-07-23 17:46:53 +02:00
|
|
|
endif()
|