Closed jvondermarck closed 1 year ago
What SDL2_mixer version have you installed?
SDL2_mixer installs a SDL2_mixerConfig.cmake
since last year, so you must use a relatively recent release.
Older Ubuntu releases won't have this (by default).
Hi @madebr I just did the command "sudo apt-get install libsdl2-mixer-dev" so i have no idea what version i have, how can i use the new version ?
I think it is apt show libsdl2-mixer-dev
.
To use a newer version, you'll need to build the library yourself.
But if all you miss is cmake support, you can easily create a FindSDL2_mixer.cmake
module and add it to your cmake module path. With this approach, you don't depend on a particular project providing cmake config files.
It can be very simple:
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_SDL2_mixer QUIET SDL2_mixer)
endif()
find_library(SDL2_mixer_LIBRARY
NAMES SDL2_mixer
HINTS ${PC_SDL2_mixer_LIBRARY_DIRS}
)
find_path(SDL2_mixer_INCLUDE_PATH
NAMES SDL2/SDL_mixer.h
HINTS ${PC_SDL2_mixer_INCLUDE_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SDL2_mixer
REQUIRED_VARS
SDL2_mixer_LIBRARY SDL2_mixer_INCLUDE_PATH
)
if(SDL2_mixer_FOUND)
if(NOT TARGET SDL2_mixer::SDL2_mixer)
add_library(SDL2_mixer::SDL2_mixer UNKNOWN IMPORTED)
set_target_properties(SDL2_mixer::SDL2_mixer PROPERTIES
IMPORTED_LOCATION "${SDL2_mixer_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_mixer_INCLUDE_PATH}"
)
endif()
endif()
I have this error my CMakeList.txt is loading :
Here is my CMakeList.txt file :
I used the command :
sudo apt-get install libsdl2-mixer-dev
to download SDL_Mixer. And I build with WSL Ubuntun.