summaryrefslogtreecommitdiffstats
path: root/libusbmuxd/CMakeLists.txt
blob: a3d5fbe059156a97432189c852d804578286c2f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
include_directories (${CMAKE_SOURCE_DIR}/common)
find_package(Threads)

option(WANT_INOTIFY "Build with inotify support" ON)
if (WANT_INOTIFY)
find_package(Inotify)
if (INOTIFY_FOUND)
  add_definitions("-DHAVE_INOTIFY")
  message("-- libusbmuxd will be built with inotify support")
endif()
endif(WANT_INOTIFY)

add_library (libusbmuxd SHARED libusbmuxd.c sock_stuff.c ${CMAKE_SOURCE_DIR}/common/utils.c)
find_library (PTHREAD pthread)

if (HAVE_PLIST)
  add_definitions("-DHAVE_PLIST")
  message("-- libusbmuxd will be built with protocol version 1 support")
endif()
if(WIN32)
  set(OPT_LIBS ${OPT_LIBS} ws2_32)
endif()
include_directories(${OPT_INCLUDES})
target_link_libraries (libusbmuxd ${CMAKE_THREAD_LIBS_INIT} ${OPT_LIBS})

# 'lib' is a UNIXism, the proper CMake target is usbmuxd
# But we can't use that due to the conflict with the usbmuxd daemon,
# so instead change the library output base name to usbmuxd here
set_target_properties(libusbmuxd PROPERTIES OUTPUT_NAME usbmuxd)
set_target_properties(libusbmuxd PROPERTIES VERSION ${LIBUSBMUXD_VERSION})
set_target_properties(libusbmuxd PROPERTIES SOVERSION ${LIBUSBMUXD_SOVERSION})

if(APPLE)
  set_target_properties(libusbmuxd PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
endif()

install(TARGETS libusbmuxd
	RUNTIME DESTINATION bin
	ARCHIVE DESTINATION lib${LIB_SUFFIX}
	LIBRARY DESTINATION lib${LIB_SUFFIX}
)
install(FILES usbmuxd.h usbmuxd-proto.h DESTINATION include)