The solution is to edit the file sdl2-config.cmake.
You can find this file with the command:
apt-file search sdl2-config
In Ubuntu, Ubuntu 16.04it is in
/usr/lib/x86_64-linux-gnu/cmake/SDL2/sdl2-config.cmake
In source file
set(prefix "/usr")
set(exec_prefix "${prefix}")
set(libdir "${prefix}/lib/x86_64-linux-gnu")
set(SDL2_PREFIX "/usr")
set(SDL2_EXEC_PREFIX "/usr")
set(SDL2_LIBDIR "${prefix}/lib/x86_64-linux-gnu")
set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2")
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2 ") <---- here
The last line has extra space that should be removed
BEFORE: set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2 ")
AFTER : set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2")
Then the problem is fixed for me.
source
share