summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt22
1 files changed, 12 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 43250b9..05e20d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,20 +121,22 @@ 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")
+ IF(NOT DEFINED CMAKE_INSTALL_UDEVRULESDIR)
+ set(PKG_GET_UDEV_DIR ${PKG_CONFIG_EXECUTABLE} --variable=udevdir udev)
+ execute_process(COMMAND ${PKG_GET_UDEV_DIR} RESULT_VARIABLE ERR OUTPUT_VARIABLE CMAKE_INSTALL_UDEVRULESDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
+ IF(${ERR})
+ set(CMAKE_INSTALL_UDEVRULESDIR "lib/udev/rules.d")
+ ELSE()
+ set(CMAKE_INSTALL_UDEVRULESDIR "${CMAKE_INSTALL_UDEVRULESDIR}/rules.d")
+ ENDIF()
+ string(REGEX REPLACE "^/" "" CMAKE_INSTALL_UDEVRULESDIR "${CMAKE_INSTALL_UDEVRULESDIR}")
+ string(REGEX REPLACE "^usr/" "" CMAKE_INSTALL_UDEVRULESDIR "${CMAKE_INSTALL_UDEVRULESDIR}") # usual prefix is usr/local
+ message(STATUS "Setting udev rules dir to ${CMAKE_INSTALL_UDEVRULESDIR}")
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}
+ DESTINATION ${CMAKE_INSTALL_UDEVRULESDIR}
)
ENDIF()