diff options
| author | Přemysl Eric Janouch <p@janouch.name> | 2021-11-07 17:19:34 +0100 | 
|---|---|---|
| committer | Přemysl Eric Janouch <p@janouch.name> | 2021-11-07 17:21:27 +0100 | 
| commit | 4cad7806ab3f147d88035ab91dc9d0ed840f1965 (patch) | |
| tree | 6d846aa713b4edad1fc94b2353774b2c1677f90f | |
| parent | 6148d62ba2969e050d13b2470ce23317e3406649 (diff) | |
| download | desktop-tools-4cad7806ab3f147d88035ab91dc9d0ed840f1965.tar.gz desktop-tools-4cad7806ab3f147d88035ab91dc9d0ed840f1965.tar.xz desktop-tools-4cad7806ab3f147d88035ab91dc9d0ed840f1965.zip | |
CMakeLists.txt: improve portability
Also, stop lying in the README that this is present in AUR.
| -rw-r--r-- | CMakeLists.txt | 41 | ||||
| -rw-r--r-- | README.adoc | 5 | 
2 files changed, 33 insertions, 13 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index d1b0105..0e18b66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,29 +16,50 @@ set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/liberty/cmake)  include (AddThreads)  find_package (PkgConfig REQUIRED) -pkg_check_modules (dependencies REQUIRED libpulse x11 xext xextproto dbus-1) +pkg_check_modules (x REQUIRED x11 xext xextproto) +pkg_check_modules (pulse REQUIRED libpulse) +pkg_check_modules (dbus REQUIRED dbus-1)  pkg_check_modules (gdm gdm glib-2.0 gio-2.0) -include_directories (${dependencies_INCLUDE_DIRS}) +include_directories ( +	${x_INCLUDE_DIRS} ${pulse_INCLUDE_DIRS} ${dbus_INCLUDE_DIRS}) +link_directories ( +	${x_LIBRARY_DIRS} ${pulse_LIBRARY_DIRS} ${dbus_LIBRARY_DIRS})  option (WITH_GDM "Compile with GDM support" ${gdm_FOUND})  # Generate a configuration file -configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h) +configure_file (${PROJECT_SOURCE_DIR}/config.h.in +	${PROJECT_BINARY_DIR}/config.h)  include_directories (${PROJECT_BINARY_DIR})  # Build -foreach (name brightness fancontrol-ng iexec input-switch priod siprandom) -	add_executable (${name} ${name}.c) -endforeach () +set (targets wmstatus paswitch siprandom big-brother) +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) +	# Only iexec could be made to use kqueue +	list (APPEND targets fancontrol-ng priod iexec) +elseif ("${CMAKE_SYSTEM_NAME}" MATCHES BSD) +	# Need this for SIGWINCH in FreeBSD and OpenBSD respectively; +	# our POSIX version macros make it undefined +	add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1) +elseif (APPLE) +	add_definitions (-D_DARWIN_C_SOURCE) +endif () -foreach (name big-brother paswitch wmstatus) +foreach (name ${targets})  	add_executable (${name} ${name}.c) -	target_link_libraries (${name} ${dependencies_LIBRARIES})  endforeach () + +target_link_libraries (big-brother ${x_LIBRARIES}) +target_link_libraries (paswitch ${pulse_LIBRARIES}) +target_link_libraries (wmstatus +	${x_LIBRARIES} ${pulse_LIBRARIES} ${dbus_LIBRARIES})  add_threads (wmstatus)  if (WITH_GDM)  	include_directories (${gdm_INCLUDE_DIRS}) +	link_directories (${gdm_LIBRARY_DIRS})  	add_executable (gdm-switch-user gdm-switch-user.c)  	target_link_libraries (gdm-switch-user ${gdm_LIBRARIES})  endif () @@ -70,8 +91,8 @@ if (WITH_GDM)  	install (TARGETS gdm-switch-user DESTINATION ${CMAKE_INSTALL_BINDIR})  endif () -install (TARGETS wmstatus paswitch brightness input-switch fancontrol-ng priod -	iexec siprandom DESTINATION ${CMAKE_INSTALL_BINDIR}) +list (REMOVE_ITEM targets big-brother) +install (TARGETS ${targets} DESTINATION ${CMAKE_INSTALL_BINDIR})  install (PROGRAMS shellify DESTINATION ${CMAKE_INSTALL_BINDIR})  install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) diff --git a/README.adoc b/README.adoc index e4d78d2..0bd0de4 100644 --- a/README.adoc +++ b/README.adoc @@ -28,12 +28,11 @@ to other people as well:   - 'big-brother' tracks the title of the active window and the idle state of     the user and writes these events to standard output. -Don't expect them to work under any OS that isn't Linux. +Few of them are useful outside of Linux.  Packages  -------- -Regular releases are sporadic.  git master should be stable enough.  You can get -a package with the latest development version from Archlinux's AUR. +Regular releases are sporadic.  git master should be stable enough.  Building  -------- | 
