aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt55
1 files changed, 36 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e18b66..233ebde 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,7 @@ include_directories (
link_directories (
${x_LIBRARY_DIRS} ${pulse_LIBRARY_DIRS} ${dbus_LIBRARY_DIRS})
-option (WITH_GDM "Compile with GDM support" ${gdm_FOUND})
+option (WITH_GDM "Compile with GDM utilities" ${gdm_FOUND})
# Generate a configuration file
configure_file (${PROJECT_SOURCE_DIR}/config.h.in
@@ -33,7 +33,7 @@ configure_file (${PROJECT_SOURCE_DIR}/config.h.in
include_directories (${PROJECT_BINARY_DIR})
# Build
-set (targets wmstatus paswitch siprandom big-brother)
+set (targets wmstatus paswitch siprandom genpass)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL Linux)
# These use Linux i2c APIs, but can be made to work on macOS
list (APPEND targets brightness input-switch)
@@ -47,7 +47,7 @@ elseif (APPLE)
add_definitions (-D_DARWIN_C_SOURCE)
endif ()
-foreach (name ${targets})
+foreach (name big-brother ${targets})
add_executable (${name} ${name}.c)
endforeach ()
@@ -58,9 +58,10 @@ target_link_libraries (wmstatus
add_threads (wmstatus)
if (WITH_GDM)
- include_directories (${gdm_INCLUDE_DIRS})
- link_directories (${gdm_LIBRARY_DIRS})
+ list (APPEND targets gdm-switch-user)
add_executable (gdm-switch-user gdm-switch-user.c)
+ target_include_directories (gdm-switch-user PUBLIC ${gdm_INCLUDE_DIRS})
+ target_link_directories (gdm-switch-user PUBLIC ${gdm_LIBRARY_DIRS})
target_link_libraries (gdm-switch-user ${gdm_LIBRARIES})
endif ()
@@ -71,27 +72,43 @@ include (GNUInstallDirs)
set (SYSTEMD_UNITDIR /lib/systemd/system
CACHE PATH "Base directory for systemd unit files")
-configure_file (${PROJECT_SOURCE_DIR}/fancontrol-ng.service.in
- ${PROJECT_BINARY_DIR}/fancontrol-ng.service @ONLY)
-install (FILES fancontrol-ng.conf.example
- DESTINATION ${CMAKE_INSTALL_DATADIR}/fancontrol-ng)
+if ("${CMAKE_SYSTEM_NAME}" STREQUAL Linux)
+ configure_file (${PROJECT_SOURCE_DIR}/fancontrol-ng.service.in
+ ${PROJECT_BINARY_DIR}/fancontrol-ng.service @ONLY)
+ install (FILES fancontrol-ng.conf.example
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/fancontrol-ng)
-configure_file (${PROJECT_SOURCE_DIR}/priod.service.in
- ${PROJECT_BINARY_DIR}/priod.service @ONLY)
-install (FILES priod.conf.example
- DESTINATION ${CMAKE_INSTALL_DATADIR}/priod)
+ configure_file (${PROJECT_SOURCE_DIR}/priod.service.in
+ ${PROJECT_BINARY_DIR}/priod.service @ONLY)
+ install (FILES priod.conf.example
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/priod)
-# System-wide unit files should be installed under /lib and not /usr/lib
-install (FILES
- ${PROJECT_BINARY_DIR}/fancontrol-ng.service
- ${PROJECT_BINARY_DIR}/priod.service
- DESTINATION "${SYSTEMD_UNITDIR}")
+ # System-wide unit files should be installed under /lib and not /usr/lib
+ install (FILES
+ ${PROJECT_BINARY_DIR}/fancontrol-ng.service
+ ${PROJECT_BINARY_DIR}/priod.service
+ DESTINATION "${SYSTEMD_UNITDIR}")
+endif ()
if (WITH_GDM)
install (TARGETS gdm-switch-user DESTINATION ${CMAKE_INSTALL_BINDIR})
endif ()
-list (REMOVE_ITEM targets big-brother)
+# These should be accessible by users, but need to touch system devices.
+# Use the setuid bit, for simplicity.
+set (SETUID "SETUID" CACHE STRING "Set this empty on permission issues")
+foreach (target brightness input-switch)
+ if (${target} IN_LIST targets)
+ list (REMOVE_ITEM targets ${target})
+ install (TARGETS ${target} DESTINATION ${CMAKE_INSTALL_BINDIR}
+ PERMISSIONS
+ OWNER_WRITE OWNER_READ OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+ ${SETUID})
+ endif ()
+endforeach ()
+
install (TARGETS ${targets} DESTINATION ${CMAKE_INSTALL_BINDIR})
install (PROGRAMS shellify DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})