Raylib Installation with CMAKE

Raylib Installation with Cmake

Installation & setting up your dev setup can be a bit compilated if you're familiar with cmake or if you're coming from a python or js world, where everying is handled by package managers.

Cmake FetchContent is a great way to install packages.

What we'll do install raylib and show how to create a very simple raylib with cmake fetchcontent.

cmake file :

cmake_minimum_required(VERSION 3.15)

project(myapp)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

include(FetchContent)
FetchContent_Declare(
    raylib
    GIT_REPOSITORY https://github.com/raysan5/raylib.git
    GIT_TAG master
    )


FetchContent_MakeAvailable(raylib)

add_executable(app main.cpp)
target_link_libraries(app
    raylib
    )