FILE(GLOB bxxviewer_source bxxviewer.cpp bxxstream.cpp drawprimitives.cpp ../../BlinkenLib/source/*.cpp *.h)
FILE(GLOB blpviewer_source blpmain.cpp blpstream.cpp drawprimitives.cpp *.h)
FILE(GLOB blpmatrix_source blpmatrix.cpp blpstream.cpp drawprimitives.cpp *.h)
FILE(GLOB mcufviewer_source blpmatrix.cpp blpstream.cpp drawprimitives.cpp *.h)


IF(APPLE)
    MESSAGE( STATUS "APPLE MACOSX found. Adding SDLMain.m/SDLMain.h to BLPViewers")
    SET( bxxviewer_source ${bxxviewer_source} ../../OSX/LostPixels/SDLMain.m ../../OSX/LostPixels/SDLMain.h )
    SET( blpviewer_source ${blpviewer_source} ../../OSX/LostPixels/SDLMain.m ../../OSX/LostPixels/SDLMain.h )
    SET( blpmatrix_source ${blpmatrix_source} ../../OSX/LostPixels/SDLMain.m ../../OSX/LostPixels/SDLMain.h )
    SET( mcufviewer_source ${mcufviewer_source} ../../OSX/LostPixels/SDLMain.m ../../OSX/LostPixels/SDLMain.h )
    # Compile SDLMain.m with C Compiler (not C++ as Cmake does by default)
    SET_SOURCE_FILES_PROPERTIES(../../OSX/LostPixels/SDLMain.m PROPERTIES LANGUAGE C)
ENDIF(APPLE)

ADD_EXECUTABLE(bxxviewer ${bxxviewer_source})
TARGET_LINK_LIBRARIES(bxxviewer ${SDL_LIBRARY} ${SDLNET_LIBRARY})

ADD_EXECUTABLE(blpviewer ${blpviewer_source})
TARGET_LINK_LIBRARIES(blpviewer ${SDL_LIBRARY} ${SDLNET_LIBRARY})

ADD_EXECUTABLE(blpmatrix ${blpmatrix_source})
TARGET_LINK_LIBRARIES(blpmatrix ${SDL_LIBRARY} ${SDLNET_LIBRARY})

ADD_EXECUTABLE(mcufviewer ${mcufviewer_source})
TARGET_LINK_LIBRARIES(mcufviewer ${SDL_LIBRARY} ${SDLNET_LIBRARY})


INSTALL(TARGETS blpviewer blpmatrix mcufviewer bxxviewer RUNTIME DESTINATION bin )
