-
Notifications
You must be signed in to change notification settings - Fork 408
/
CMakeLists.txt
48 lines (39 loc) · 1.38 KB
/
CMakeLists.txt
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
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.4.3 FATAL_ERROR)
list(APPEND HIDAPI_PUBLIC_HEADERS "hidapi_darwin.h")
add_library(hidapi_darwin
${HIDAPI_PUBLIC_HEADERS}
hid.c
)
find_package(Threads REQUIRED)
target_link_libraries(hidapi_darwin
PUBLIC hidapi_include
PRIVATE Threads::Threads
PRIVATE "-framework IOKit" "-framework CoreFoundation"
)
set_target_properties(hidapi_darwin
PROPERTIES
EXPORT_NAME "darwin"
OUTPUT_NAME "hidapi"
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
MACHO_COMPATIBILITY_VERSION ${PROJECT_VERSION_MAJOR}
FRAMEWORK_VERSION ${PROJECT_VERSION_MAJOR}
PUBLIC_HEADER "${HIDAPI_PUBLIC_HEADERS}"
)
# compatibility with find_package()
add_library(hidapi::darwin ALIAS hidapi_darwin)
# compatibility with raw library link
add_library(hidapi ALIAS hidapi_darwin)
set(PUBLIC_HEADER_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
if(NOT CMAKE_FRAMEWORK)
set(PUBLIC_HEADER_DESTINATION "${PUBLIC_HEADER_DESTINATION}/hidapi")
endif()
if(HIDAPI_INSTALL_TARGETS)
install(TARGETS hidapi_darwin EXPORT hidapi
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
FRAMEWORK DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${PUBLIC_HEADER_DESTINATION}"
)
endif()
hidapi_configure_pc("${PROJECT_ROOT}/pc/hidapi.pc.in")