-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Working with CMake
Andreas Stallinger edited this page Jul 11, 2020
·
11 revisions
If you know that anyone who builds your project, has raylib already installed, a simple CMakeLists.txt
could look like this:
cmake_minimum_required(VERSION 3.15)
project(my_project)
find_package(raylib 2.5.0 REQUIRED) # Requires at least version 2.5.0
set(CMAKE_C_STANDARD 11)
add_executable(my_project main.c)
target_link_libraries(my_project raylib)
To build, use these commands:
mkdir build # Create a build directory
cd build && cmake .. # Build from that directory so the build files are in one place
cmake --build . # Build the project
If you want someone who builds your project to be able to download and build raylib with it, the CMakeLists.txt at projects/CMake will help you.
CMake supports a range of generators, which can be used to generate project files for IDEs/Build-Tools such as Visual Studio, Ninja or Sublime Text 2. e.g. for Xcode you can run cmake -G 'Xcode' ..
to have it generate project files for import into Xcode.
www.raylib.com | itch.io | GitHub | Discord | YouTube
- Architecture
- Syntax analysis
- Data structures
- Enumerated types
- External dependencies
- GLFW dependency
- libc dependency
- Platforms and graphics
- Input system
- Default shader
- Custom shaders
- Coding conventions
- Integration with other libs
- Working on Windows
- Working on macOS
- Working on GNU Linux
- Working on Chrome OS
- Working on FreeBSD
- Working on Raspberry Pi
- Working for Android
- Working for Web (HTML5)
- Creating Discord Activities
- Working anywhere with CMake
- CMake Build Options
- raylib templates: Get started easily
- How To: Quick C/C++ Setup in Visual Studio 2022, GCC or MinGW
- How To: C# Visual Studio Setup
- How To: VSCode
- How To: Eclipse
- How To: Sublime Text
- How To: Code::Blocks