Skip to content

Instantly share code, notes, and snippets.

@srli
Created October 17, 2019 01:24
Show Gist options
  • Save srli/be8033cc4a3ae059503c39486859654e to your computer and use it in GitHub Desktop.
Save srli/be8033cc4a3ae059503c39486859654e to your computer and use it in GitHub Desktop.
Modified CMakeLists.txt for v1.91 h-encore build
cmake_minimum_required(VERSION 3.9)
find_package(Threads)
find_package(LibXml2 REQUIRED)
if (MINGW)
add_definitions(-mno-ms-bitfields)
endif ()
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
add_definitions(-Wall -Wextra -Wno-unused-parameter -Wno-parentheses)
endif ()
add_definitions(-DHAVE_ICONV -DHAVE_LIMITS_H -DPTP_USB_SUPPORT -DPTP_IP_SUPPORT -DUSING_STATIC_LIBICONV -DLIBXML_STATIC)
set (COMMON_SRC
vitamtp.h
datautils.c
device.c
ptp.c
usb.c
vitamtp.c
wireless.c)
if (WIN32)
set (OS_SRC
asprintf.c
socketpair.c)
endif ()
add_library(vitamtp STATIC ${COMMON_SRC} ${OS_SRC})
target_include_directories(vitamtp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} /usr/local/include)
target_link_libraries(vitamtp Threads::Threads)
if (WIN32)
target_link_libraries(vitamtp libusb xml2 iconv ws2_32)
else ()
target_include_directories(vitamtp PRIVATE ${LIBUSB_INCLUDE_DIR} PRIVATE ${LIBXML2_INCLUDE_DIR})
target_link_libraries(vitamtp ${LIBUSB_LIBRARY} ${LIBXML2_LIBRARIES} Iconv::Iconv)
endif ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment