]> git.zarvox.org Git - libtouchmouse.git/blob - CMakeLists.txt
More doxygen.
[libtouchmouse.git] / CMakeLists.txt
1 # libtouchmouse
2
3 cmake_minimum_required(VERSION 2.6)
4
5 project(libtouchmouse)
6
7 # Set up output folders
8 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
9 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
10
11 # Add include path to hidapi.h
12 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/hidapi/hidapi ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR})
13
14 # Set library sources
15 if(WIN32)
16         # Win32-specific options go here.
17         message(STATUS "Detected Win32 system")
18         list(APPEND LIBSRC hidapi/windows/hid.c)
19         list(APPEND PLATFORM_LIBS setupapi)
20 elseif(APPLE)
21         # Apple-specific options go here.
22         message(STATUS "Detected Apple system")
23         list(APPEND LIBSRC hidapi/mac/hid.c)
24         set(CMAKE_SHARED_LINKER_FLAGS "-framework IOKit -framework CoreFoundation")
25         set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework CoreFoundation")
26 else()
27         # Linux-specific options go here.
28         message(STATUS "Detected non-windows, non-apple system; assuming some Linux variant")
29         include_directories(/usr/include/libusb-1.0)
30         list(APPEND LIBSRC hidapi/linux/hid-libusb.c)
31         list(APPEND PLATFORM_LIBS usb-1.0 pthread rt)
32 endif()
33 list(APPEND LIBSRC src/touchmouse.c src/mono_timer.c)
34
35 set(CMAKE_C_FLAGS "-Wall -ggdb")
36
37 # Build library
38 add_library(touchmouse SHARED ${LIBSRC})
39
40 if(WIN32)
41         target_link_libraries(touchmouse ${PLATFORM_LIBS})
42 endif()
43
44 # Build examples
45 add_subdirectory(examples)
46