mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Updated Working with CMake (markdown)
@ -4,13 +4,20 @@ If you installed raylib with a package manager, or used `make install`, a simple
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(my_project)
|
||||
|
||||
find_package(raylib 2.5.0 REQUIRED) # Requires at least version 2.5.0
|
||||
find_package(raylib 3.0 REQUIRED) # Requires at least version 3.0
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD 11) # Requires C11 standard
|
||||
|
||||
add_executable(my_project main.c)
|
||||
add_executable(${PROJECT_NAME} main.c)
|
||||
|
||||
target_link_libraries(my_project raylib)
|
||||
target_link_libraries(${PROJECT_NAME} raylib)
|
||||
|
||||
# Checks if OSX and links appropriate frameworks (Only required on MacOS)
|
||||
if (APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} "-framework IOKit")
|
||||
target_link_libraries(${PROJECT_NAME} "-framework Cocoa")
|
||||
target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
|
||||
endif()
|
||||
```
|
||||
To build, use these commands:
|
||||
```cmake
|
||||
|
||||
Reference in New Issue
Block a user