0.0.2. Added version record and libuvcTarget*.cmake

This commit is contained in:
Ken Tossell 2013-10-04 16:15:30 -04:00
Родитель 5d540b1ae5
Коммит 4a19b4fab8
2 изменённых файлов: 36 добавлений и 6 удалений

Просмотреть файл

@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 2.6)
project(libuvc)
set(libuvc_VERSION_MAJOR 0)
set(libuvc_VERSION_MINOR 0)
set(libuvc_VERSION_PATCH 2)
set(libuvc_VERSION ${libuvc_VERSION_MAJOR}.${libuvc_VERSION_MINOR}.${libuvc_VERSION_PATCH})
find_library(LIBUSB_LIBRARY_NAMES usb-1.0
PATHS /opt/local/lib)
@ -19,22 +24,36 @@ add_library(uvc SHARED src/ctrl.c src/device.c src/diag.c
src/frame.c src/init.c src/stream.c
src/misc.c)
set_target_properties(uvc PROPERTIES
PUBLIC_HEADER "include/libuvc/libuvc.h")
target_link_libraries(uvc ${LIBUSB_LIBRARY_NAMES})
#add_executable(test src/test.c)
#target_link_libraries(test uvc ${LIBUSB_LIBRARY_NAMES} opencv_highgui
# opencv_core)
install(TARGETS uvc
EXPORT libuvcTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libuvc"
)
export(TARGETS uvc
FILE "${PROJECT_BINARY_DIR}/libuvcTargets.cmake")
export(PACKAGE libuvc)
set(CONF_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
set(CONF_LIBRARY "${CMAKE_INSTALL_PREFIX}/lib/libuvc.so")
configure_file(libuvcConfig.cmake.in ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/libuvcConfig.cmake)
install(TARGETS uvc
LIBRARY DESTINATION lib
)
configure_file(libuvcConfigVersion.cmake.in ${PROJECT_BINARY_DIR}/libuvcConfigVersion.cmake @ONLY)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/libuvc/libuvc.h"
DESTINATION include/libuvc)
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/libuvcConfig.cmake"
"${PROJECT_BINARY_DIR}/libuvcConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}")
install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/libuvcConfig.cmake" DESTINATION "${INSTALL_CMAKE_DIR}")
install(EXPORT libuvcTargets
DESTINATION "${INSTALL_CMAKE_DIR}")

Просмотреть файл

@ -0,0 +1,11 @@
set(PACKAGE_VERSION "@libuvc_VERSION@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()