-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
34 lines (30 loc) · 1.64 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
cmake_minimum_required(VERSION 3.11)
project(upload_dumper C)
add_executable(${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/src/dumper.c
${PROJECT_SOURCE_DIR}/src/hexdump.c
)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/include)
# Libusb configuration
if(MSVC)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/libusb-1.0.26-binaries/libusb-MinGW-x64/include)
target_link_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/libusb-1.0.26-binaries/VS2015-x64/lib)
target_link_libraries(${PROJECT_NAME} PRIVATE libusb-1.0)
elseif(WIN32)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/libusb-1.0.26-binaries/libusb-MinGW-x64/include)
target_link_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/libusb-1.0.26-binaries/libusb-MinGW-x64/lib)
target_link_libraries(${PROJECT_NAME} PRIVATE libusb-1.0)
elseif(UNIX)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
message(STATUS "libusb include dirs: ${LIBUSB_INCLUDE_DIRS}")
target_include_directories(${PROJECT_NAME} PRIVATE ${LIBUSB_INCLUDE_DIRS})
target_link_directories(${PROJECT_NAME} PRIVATE ${LIBUSB_LIBRARY_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBUSB_LIBRARIES})
elseif(APPLE)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/libusb-1.0.26-binaries/macos_11.6/include)
target_link_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/libusb-1.0.26-binaries/macos_11.6/lib)
target_link_libraries(${PROJECT_NAME} PRIVATE libusb-1.0)
else()
message(FATAL_ERROR "Unsupported platform!")
endif()