CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(lthor C) SET(LIBTHOR_SRCS libthor/thor_acm.c libthor/thor.c libthor/thor_raw_file.c libthor/thor_tar.c libthor/thor_usb.c ) SET(SRCS lthor.c ) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/libthor) SET(VENDOR "samsung") SET(PACKAGE ${PROJECT_NAME}) SET(PKGNAME "${PACKAGE}") SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(BINDIR "${PREFIX}/bin") SET(PACKAGE_VERSION "2.0") IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE "Release") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED libarchive libusb-1.0>=1.0.17 ) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") SET(CMAKE_C_FLAGS_RELEASE "-O2") ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"") ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_DEFINITIONS("-DPACKAGE_VERSION=\"${PACKAGE_VERSION}\"") ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64") #SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") IF(APPLE) SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") INCLUDE_DIRECTORIES("/usr/include/machine") ELSE() SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") ENDIF() ADD_LIBRARY(libthor ${LIBTHOR_SRCS}) ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} libthor ${pkgs_LDFLAGS}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) INSTALL(FILES 99-lthor.rules DESTINATION "/etc/udev/rules.d" COMPONENT "udev")