Fixed bug 2187 - CMake is not adding src/core/linux/*.c to the build, linking to SDL results in errors.
authorSam Lantinga <slouken@libsdl.org>
Sun, 03 Nov 2013 11:00:28 -0800
changeset 79034d3e6191c807
parent 7902 0c2e2b91eeea
child 7904 915b9b6c9fa0
Fixed bug 2187 - CMake is not adding src/core/linux/*.c to the build, linking to SDL results in errors.

Daniel Ribeiro Maciel

CMake is not adding src/core/linux/*.c to the build, linking to SDL results in errors:

(...)/libSDL2-2.0.so.1.0.1: undefined reference to `SDL_UDEV_AddCallback'
(...)/libSDL2-2.0.so.1.0.1: undefined reference to `SDL_UDEV_Poll'
(...)/libSDL2-2.0.so.1.0.1: undefined reference to `SDL_UDEV_Init'
(...)/libSDL2-2.0.so.1.0.1: undefined reference to `SDL_UDEV_Quit'
(...)/libSDL2-2.0.so.1.0.1: undefined reference to `SDL_UDEV_DelCallback'
(...)/libSDL2-2.0.so.1.0.1: undefined reference to `SDL_UDEV_Scan'
collect2: error: ld returned 1 exit status
CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Sun Nov 03 09:55:27 2013 -0800
     1.2 +++ b/CMakeLists.txt	Sun Nov 03 11:00:28 2013 -0800
     1.3 @@ -648,6 +648,10 @@
     1.4          #error EVIOCGNAME() ioctl not available
     1.5          #endif
     1.6          int main(int argc, char** argv) {}" HAVE_INPUT_EVENTS)
     1.7 +
     1.8 +    file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c)
     1.9 +    set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
    1.10 +
    1.11      if(HAVE_INPUT_EVENTS)
    1.12        set(SDL_INPUT_LINUXEV 1)
    1.13      endif(HAVE_INPUT_EVENTS)
    1.14 @@ -746,8 +750,8 @@
    1.15      #include <windows.h>
    1.16      int main(int argc, char **argv) { }" HAVE_WIN32_CC)
    1.17  
    1.18 -  file(GLOB WIN_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
    1.19 -  set(SOURCE_FILES ${SOURCE_FILES} ${WIN_SOURCES})
    1.20 +  file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
    1.21 +  set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
    1.22  
    1.23    # Check for DirectX
    1.24    if(DIRECTX)