CLion Just Made Raylib Setup Too Easy

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?

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

CLion comes with smart completion, live CMake feedback, and built-in Git integration.


3) Choosing Your Compiler

On Windows, you can pick from:

All are supported by CLion. Pick one depending on your workflow:

If you haven’t installed these yet, follow their official instructions:


4) Creating a New CLion Project

  1. Open CLion → New Project.
  2. Select C++ Executable template.
  3. Set Project Name (e.g., RambodDevRaylib).
  4. Choose C++ Standard (recommend C++23).
  5. Click Create.

CLion generates a starter main.cpp and a CMakeLists.txt.


5) Configuring Toolchains in CLion

👉 This flexibility is great if you build projects for multiple platforms.


6) Setting Up vcpkg in CLion

  1. Open View → Tool Windows → vcpkg.
  2. In the vcpkg panel, click the + button to add a repository.
  3. Fill out:
    • Name (e.g., “vcpkg classic”).
    • URL → leave default GitHub URL unless using a fork.
    • Directory → the folder where you installed/cloned vcpkg.
  4. 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

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)

9) Reloading CMake


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 into CMakeLists.txt. Replace main with your project name. Reload CMake—retry if the first attempt errors. Paste a Raylib Hello World into main.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:

💡 Perfect for indie devs, students, and prototyping.

👉 Watch the full video here: YouTube Link 👉 Try Raylib: Raylib GitHub 👉 More tutorials: Rambod Dev Channel