"raylib.h" not found solution for M2

I used this solution to solve the problem of “raylib.h” not being found in practice.

IDE: CLion

  1. brew install pkg-config
  2. brew install raylib
  3. Write the contents of the CMakeLists.txt file.
cmake_minimum_required(VERSION 3.26)
project(untitled)

set(CMAKE_CXX_STANDARD 17)

# Look at
find_package(raylib)

add_executable(${PROJECT_NAME}
        axe_game.cpp)
# Look at
target_link_libraries(${PROJECT_NAME} raylib)

if (APPLE)
    target_link_libraries(${PROJECT_NAME} "-framework IOKit")
    target_link_libraries(${PROJECT_NAME} "-framework Cocoa")
    target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
endif()

Privacy & Terms