CMake und SDL hilfe!



  • Hi,
    ich bekomme ein einfaches SDL Programm nicht mit CMake übersetzt. Er findet die SDL Libraries nicht.

    linking Test (c++)
    CMakeFiles/Test.dir/main.o: In function main': main.cpp:(.text+0x8b): undefined reference toSDL_Init'
    main.cpp:(.text+0xd6): undefined reference to SDL_SetVideoMode' main.cpp:(.text+0xe9): undefined reference toSDL_GetError'
    main.cpp:(.text+0x14c): undefined reference to `SDL_PollEvent'
    collect2: ld returned 1 exit status
    make[2]: *** [Test] Error 1

    Meine CMakeLists.txt

    PROJECT(Test)
    FIND_PACKAGE(SDL)
    INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
    LINK_LIBRARIES(${SDLMAIN_LIBRARIES} ${SDL_LIBRARIES})
    ADD_EXECUTABLE(Test main.cpp)
    

    System: Kubuntu 6.06. Die libSDL-dev Files sind auch installiert.

    An was kann das liegen?

    Danke



  • My German isn't that good, sorry. I'll answer in English.
    If you check /usr/share/CMake/Modules/FindSDL.cmake you'll see that it defines SDL_LIBRARY, not SDL_LIBRARIES. (That sucks!)

    Had this error myself for a long time...


Anmelden zum Antworten