I am building cmake
app that uses SDL. But this code says that SDL not found:
find_package(SDL)
find_package(SDL_mixer)
find_package(SDL_image)
find_package(SDL_ttf)
...
if( SDL_FOUND STREQUAL "YES" )
MESSAGE( STATUS "SDL FOUND: " ${SDL_INCLUDE_DIR} " : " ${SDL_LIBRARY} )
link_directories( ${SDL_LIBRARY} )
else( SDL_FOUND STREQUAL "NO" )
MESSAGE( STATUS "SDL NOT FOUND: " ${SDL_INCLUDE_DIR} " : " ${SDL_LIBRARY} )
endif( SDL_FOUND STREQUAL "YES" )
Prints this strange message:
-- SDL NOT FOUND: /usr/include/SDL : /usr/lib/x86_64-linux-gnu/libSDLmain.a/usr/lib/x86_64-linux-gnu/libSDL.so-lpthread
As I checked, /usr/include/SDL
exsist and contain all reuired headers, and library files (.a
and .so
) is at /usr/lib/x86_64-linux-gnu
. What is going wrong?
UPD: After replacing STREQUAL
by simple boolean check I can see it:
-- SDL FOUND: /usr/include/SDL : /usr/lib/x86_64-linux-gnu/libSDLmain.a/usr/lib/x86_64-linux-gnu/libSDL.so-lpthread
CMake Warning (dev) at CMakeLists.txt:55 (link_directories):
This command specifies the relative path
-lpthread
as a link directory.
Policy CMP0015 is not set: link_directories() treats paths relative to the
source dir. Run "cmake --help-policy CMP0015" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
But make
failed:
fatal error: SDL.h: No such file or directory
0 Answers