
CLion Just Made Raylib Setup Too Easy
Set up Raylib in CLion with vcpkg and CMake. Minimal CMakeLists, compiler setup, and smooth workflow for clean, fast C++ game dev in UE5 or indie projects.
This is Rambod, and in this guide we’re setting up CLion for modern C++ game development with Raylib.
CLion is now free for non-commercial use, which makes it one of the most powerful C++ IDEs available to indie developers, students, or hobbyists. Pairing CLion with CMake and vcpkg gives you a clean, fast workflow with zero manual library hunting.
By the end of this tutorial, you’ll have a working Raylib Hello World project running inside CLion.
1) Why CLion + CMake + vcpkg?
- CLion → professional C++ IDE with deep debugging, real-time code analysis, and first-class CMake integration.
- CMake → the standard build system for cross-platform C++ projects.
- vcpkg → Microsoft’s package manager for C++ libraries. Works like npm/pip: search, install, and go.
This stack means no more manually setting up headers and binaries. You just add Raylib from vcpkg, update CMakeLists.txt
, and run.
2) Installing CLion
- Download from JetBrains CLion.
- Make sure you grab the “Free for Non-Commercial Use” version.
- Available for Windows, macOS, Linux.
CLion comes with smart completion, live CMake feedback, and built-in Git integration.
3) Choosing Your Compiler
On Windows, you can pick from:
- MSVC (Microsoft Visual C++ via Visual Studio)
- MinGW
- Clang/LLVM
All are supported by CLion. Pick one depending on your workflow:
- MSVC → best for Windows-only projects.
- MinGW → lighter setup, works well with Raylib.
- Clang → more cross-platform consistency.
If you haven’t installed these yet, follow their official instructions:
4) Creating a New CLion Project
- Open CLion → New Project.
- Select C++ Executable template.
- Set Project Name (e.g.,
RambodDevRaylib
). - Choose C++ Standard (recommend
C++23
). - Click Create.
CLion generates a starter main.cpp
and a CMakeLists.txt
.
5) Configuring Toolchains in CLion
- Go to Settings → Build, Execution, Deployment → Toolchains.
- CLion auto-detects compilers on your system.
- Drag your preferred one to the top (MSVC, MinGW, or Clang).
- You can switch later if needed.
👉 This flexibility is great if you build projects for multiple platforms.
6) Setting Up vcpkg in CLion
- Open View → Tool Windows → vcpkg.
- In the vcpkg panel, click the + button to add a repository.
- Fill out:
- Name (e.g., “vcpkg classic”).
- URL → leave default GitHub URL unless using a fork.
- Directory → the folder where you installed/cloned vcpkg.
- Check both options:
- Add integration to current CMake profiles.
- Add integration to Debug builds.
When the repo is active, its icon turns yellow and CLion reloads CMake.
7) Installing Raylib via vcpkg
- In the vcpkg tool window, search for raylib.
- Select it → click Install.
- Once installed, CLion suggests the necessary CMake lines.
You’ll get something like:
find_package(raylib CONFIG REQUIRED)
target_link_libraries(RambodDev PRIVATE raylib)
⚠️ Replace RambodDev
with your actual project name from add_executable
.
8) Updating CMakeLists.txt
Your CMakeLists.txt
should look like this:
cmake_minimum_required(VERSION 3.26)
project(RambodDevRaylib)
set(CMAKE_CXX_STANDARD 23)
add_executable(RambodDevRaylib main.cpp)
find_package(raylib CONFIG REQUIRED)
target_link_libraries(RambodDevRaylib PRIVATE raylib)
- Place
find_package
andtarget_link_libraries
afteradd_executable
. - If you misplace them, CMake will throw errors.
9) Reloading CMake
- Click the Reload CMake button in the left panel.
- First reload may error out → just retry once.
- On second load, CLion usually resolves it.
10) Writing the Raylib Hello World
Replace main.cpp
with this:
#include "raylib.h"
int main() {
InitWindow(800, 600, "Hello Raylib");
SetTargetFPS(60);
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Hello World from Raylib + CLion!", 190, 200, 20, BLACK);
EndDrawing();
}
CloseWindow();
return 0;
}
Build & Run → you now have a working Raylib project.
Subtitle Expansion (Tutorial Flow)
“This is Rambod. CLion is now free for non-commercial use. It’s a professional IDE built for C++ with CMake integration. Pair it with vcpkg and Raylib for a modern workflow. Download CLion from JetBrains, pick a compiler (MSVC, MinGW, or Clang), and create a new C++ executable project. In Settings → Toolchains, reorder compilers as you like. Open the vcpkg tool window, add your repo, check integration, and reload. Search for Raylib, install it, and copy the
find_package
+target_link_libraries
lines intoCMakeLists.txt
. Replacemain
with your project name. Reload CMake—retry if the first attempt errors. Paste a Raylib Hello World intomain.cpp
, build, and run. You now have a clean, dynamic Raylib setup inside CLion with zero manual setup.”
Wrap-Up
We just built a minimal, professional C++ workflow:
- CLion (free for non-commercial use) as the IDE.
- CMake as the build system.
- vcpkg as the package manager.
- Raylib integrated in minutes.
💡 Perfect for indie devs, students, and prototyping.
👉 Watch the full video here: YouTube Link 👉 Try Raylib: Raylib GitHub 👉 More tutorials: Rambod Dev Channel