]> git.zarvox.org Git - libtouchmouse.git/commitdiff
Small CMake refactor.
authorDrew Fisher <drew.m.fisher@gmail.com>
Sun, 13 Nov 2011 03:41:00 +0000 (19:41 -0800)
committerDrew Fisher <drew.m.fisher@gmail.com>
Sun, 13 Nov 2011 03:41:00 +0000 (19:41 -0800)
Signed-off-by: Drew Fisher <drew.m.fisher@gmail.com>
CMakeLists.txt
examples/consoledemo/CMakeLists.txt
examples/qtview/CMakeLists.txt

index 570592fceadf3dd1f140307a364ac8f76dcb22a1..61f6be77eaf4404f8acb82e29caa86d4f6c70a4f 100644 (file)
@@ -16,6 +16,7 @@ if(WIN32)
        # Win32-specific options go here.
        message(STATUS "Detected Win32 system")
        list(APPEND LIBSRC hidapi/windows/hid.c)
+       list(APPEND PLATFORM_LIBS setupapi)
 elseif(APPLE)
        # Apple-specific options go here.
        message(STATUS "Detected Apple system")
@@ -27,6 +28,7 @@ else()
        message(STATUS "Detected non-windows, non-apple system; assuming some Linux variant")
        include_directories(/usr/include/libusb-1.0)
        list(APPEND LIBSRC hidapi/linux/hid-libusb.c)
+       list(APPEND PLATFORM_LIBS usb-1.0 pthread rt)
 endif()
 list(APPEND LIBSRC src/touchmouse.c src/mono_timer.c)
 
index cebf5d18963faa111b34b1228394a56a38919ca6..2ab0f407eb841ac8bc28d87843935111a7182e8c 100644 (file)
@@ -1,10 +1,4 @@
 
 add_executable(consoledemo consoledemo.c)
-if(WIN32)
-       target_link_libraries(consoledemo touchmouse setupapi)
-elseif(NOT APPLE)
-       target_link_libraries(consoledemo touchmouse usb-1.0 pthread rt)
-else()
-       target_link_libraries(consoledemo touchmouse)
-endif()
+target_link_libraries(consoledemo touchmouse ${PLATFORM_LIBS})
 
index 0bd704b5fd46b5ac9b75d59aafa77f3e8c773ea5..fbbf1bca883cb4e7ced4b4e730dbc9725b13dd44 100644 (file)
@@ -12,13 +12,7 @@ if(QT4_FOUND)
        QT4_WRAP_CPP(QTVIEW_MOC_OUTFILES ${QTVIEW_HEADERS} )
 
        add_executable(qtview ${QTVIEW_SOURCES} ${QTVIEW_MOC_OUTFILES})
-       if(WIN32)
-               target_link_libraries(qtview touchmouse ${QT_LIBRARIES} setupapi)
-       elseif(NOT APPLE)
-               target_link_libraries(qtview touchmouse ${QT_LIBRARIES} usb-1.0 pthread rt)
-       else()
-               target_link_libraries(qtview touchmouse ${QT_LIBRARIES})
-       endif()
+       target_link_libraries(qtview touchmouse ${QT_LIBRARIES} ${PLATFORM_LIBS})
 
 else()
        message(STATUS "Didn't find Qt, will not build qtview example")