Installing IrrKlang in a CLion/Arch/CMake project

  c++, clion, cmake, irrklang

I am trying to link the IrrKlang library into my CLion project however, I cannot get the library to be recognized, does anyone have any experience getting libraries like this working on a CLion project or have any idea how I could do it. So far I have tried downloading the IrrKlang library from the site, putting the .so library files in /usr/lib and then the folder containing header files in /usr/include and my CMakeLists.txt is included below and I believe it may have something to do with how I set up my CMakeLists.txt so if anyone has any idea on how to link it with that would be good. Thanks in advance!

CMakeLists.txt:

cmake_minimum_required(VERSION 3.17)
project(Racer)

find_package(Freetype REQUIRED)
find_library(irrklang REQUIRED)

set(CMAKE_CXX_STANDARD 20)
set(OpenGlLinkers -lglut -lGLU -lGL -lGLEW -lfreeimage -lfreetype -lirrklang)

set(irrklang_DIR ${CMAKE_SOURCE_DIR}/irrKlang)

add_executable(Racer main.cpp shaders/Shader.cpp shaders/Shader.h Square.h Square.cpp Circle.h Circle.cpp ImageLoading.cpp ImageLoading.h Car.cpp Car.h OBB.cpp OBB.h FreeImage.h FreeType.h FreeType.cpp Wall.cpp Wall.h Marker.cpp Marker.h irrKlang.h  conio.h)
target_link_libraries(Racer ${OpenGlLinkers} ${FREETYPE_LIBRARIES})
target_include_directories(Racer PRIVATE ${FREETYPE_INCLUDE_DIRS})

The current error from CMake is this:

CMake Error at CMakeLists.txt:5 (find_library):
  Could not find irrklang using the following names:

However, I think it’s likely that my attempt at changing the CMkaeLists.txt file is completely wrong!

Source: Windows Questions C++

LEAVE A COMMENT