summaryrefslogtreecommitdiff
path: root/contrib/SDL-3.2.8/src/hidapi/hidtest/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/SDL-3.2.8/src/hidapi/hidtest/CMakeLists.txt')
-rw-r--r--contrib/SDL-3.2.8/src/hidapi/hidtest/CMakeLists.txt40
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/hidapi/hidtest/CMakeLists.txt b/contrib/SDL-3.2.8/src/hidapi/hidtest/CMakeLists.txt
new file mode 100644
index 0000000..19c50e1
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/hidapi/hidtest/CMakeLists.txt
@@ -0,0 +1,40 @@
1cmake_minimum_required(VERSION 3.1.3...3.25 FATAL_ERROR)
2project(hidtest C)
3
4if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
5 # hidtest is build as a standalone project
6
7 if(POLICY CMP0074)
8 # allow using hidapi_ROOT if CMake supports it
9 cmake_policy(SET CMP0074 NEW)
10 endif()
11
12 find_package(hidapi 0.12 REQUIRED)
13 message(STATUS "Using HIDAPI: ${hidapi_VERSION}")
14else()
15 # hidtest is built as part of the main HIDAPI build
16 message(STATUS "Building hidtest")
17endif()
18
19set(HIDAPI_HIDTEST_TARGETS)
20if(NOT WIN32 AND NOT APPLE AND CMAKE_SYSTEM_NAME MATCHES "Linux")
21 if(TARGET hidapi::hidraw)
22 add_executable(hidtest_hidraw test.c)
23 target_link_libraries(hidtest_hidraw hidapi::hidraw)
24 list(APPEND HIDAPI_HIDTEST_TARGETS hidtest_hidraw)
25 endif()
26 if(TARGET hidapi::libusb)
27 add_executable(hidtest_libusb test.c)
28 target_compile_definitions(hidtest_libusb PRIVATE USING_HIDAPI_LIBUSB)
29 target_link_libraries(hidtest_libusb hidapi::libusb)
30 list(APPEND HIDAPI_HIDTEST_TARGETS hidtest_libusb)
31 endif()
32else()
33 add_executable(hidtest test.c)
34 target_link_libraries(hidtest hidapi::hidapi)
35 list(APPEND HIDAPI_HIDTEST_TARGETS hidtest)
36endif()
37
38install(TARGETS ${HIDAPI_HIDTEST_TARGETS}
39 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
40)