diff options
author | David Seifert <soap@gentoo.org> | 2018-03-11 11:31:57 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2018-03-13 09:37:42 +0100 |
commit | b22b36f89e8924bd5eeef1105ce74a2df4ba02bd (patch) | |
tree | a309ee57b7696a4ffca9a24398e974e9c4bd705a /CMakeLists.txt | |
parent | 15dc909b1bd2621b64c7fd58a7cf55a4778876cf (diff) | |
download | libnitrokey-b22b36f89e8924bd5eeef1105ce74a2df4ba02bd.tar.gz libnitrokey-b22b36f89e8924bd5eeef1105ce74a2df4ba02bd.tar.bz2 |
Allow overriding of udev rules dir
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 22 |
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() |