diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2018-01-31 12:55:54 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2018-01-31 12:55:54 +0100 |
commit | 3e37da97c7b2417251585c1d985b54c9a71561e7 (patch) | |
tree | 8e241d9ce51ae017c4976e41f7301fb8568983a1 /CMakeLists.txt | |
parent | 25e458ea8fdd4d704ce29709852b122cbcad5f06 (diff) | |
parent | 248b08c41ee851864263979d1164e7c8be897d63 (diff) | |
download | libnitrokey-3e37da97c7b2417251585c1d985b54c9a71561e7.tar.gz libnitrokey-3e37da97c7b2417251585c1d985b54c9a71561e7.tar.bz2 |
Merge branch 'add_udev'
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 360c391..5a4ebb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,25 @@ file(GLOB LIB_INCLUDES "include/*.h" "NK_C_API.h") install (FILES ${LIB_INCLUDES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) install (TARGETS nitrokey DESTINATION ${CMAKE_INSTALL_LIBDIR}) +IF(NOT WIN32) + # Install Nitrokey udev rules + set(PKG_GET_UDEV_DIR ${PKG_CONFIG_EXECUTABLE} --variable=udevdir udev) + execute_process(COMMAND ${PKG_GET_UDEV_DIR} RESULT_VARIABLE ERR OUTPUT_VARIABLE UDEV_MAIN_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) + IF(${ERR}) + set(UDEV_MAIN_DIR "lib/udev/rules.d") + ELSE() + set(UDEV_MAIN_DIR "${UDEV_MAIN_DIR}/rules.d") + ENDIF() + string(REGEX REPLACE "^/" "" UDEV_MAIN_DIR "${UDEV_MAIN_DIR}") + string(REGEX REPLACE "^usr/" "" UDEV_MAIN_DIR "${UDEV_MAIN_DIR}") # usual prefix is usr/local + message(STATUS "Setting udev rules dir to ${UDEV_MAIN_DIR}") + + install(FILES + ${CMAKE_SOURCE_DIR}/data/41-nitrokey.rules + DESTINATION ${UDEV_MAIN_DIR} + ) +ENDIF() + # configure and install pkg-config file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libnitrokey.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libnitrokey-1.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnitrokey-1.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) |