From: Drew Fisher Date: Sun, 13 Nov 2011 03:41:00 +0000 (-0800) Subject: Small CMake refactor. X-Git-Url: http://git.zarvox.org/static/%7Bthis.props.bicon_url%7D?a=commitdiff_plain;h=62d0311fae9961bf192b090d9c2070af1bf9fdef;p=libtouchmouse.git Small CMake refactor. Signed-off-by: Drew Fisher --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 570592f..61f6be7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/examples/consoledemo/CMakeLists.txt b/examples/consoledemo/CMakeLists.txt index cebf5d1..2ab0f40 100644 --- a/examples/consoledemo/CMakeLists.txt +++ b/examples/consoledemo/CMakeLists.txt @@ -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}) diff --git a/examples/qtview/CMakeLists.txt b/examples/qtview/CMakeLists.txt index 0bd704b..fbbf1bc 100644 --- a/examples/qtview/CMakeLists.txt +++ b/examples/qtview/CMakeLists.txt @@ -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")