Compare commits

...

2 Commits

Author SHA1 Message Date
Přemysl Eric Janouch 9e09ef39b7
Bump minimum CMake version to 3.0
A nice, round number.  This allows us to remove some boilerplate.
2020-10-26 18:44:08 +01:00
Přemysl Eric Janouch 68dd99bc63
CMakeLists.txt: cleanup
Many executables had completely unnecessary dependencies.
2020-10-26 18:39:42 +01:00
2 changed files with 15 additions and 47 deletions

View File

@ -1,5 +1,5 @@
project (desktop-tools C)
cmake_minimum_required (VERSION 2.8.11)
cmake_minimum_required (VERSION 3.0)
project (desktop-tools VERSION 0.1.0 LANGUAGES C)
# Moar warnings
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
@ -8,15 +8,6 @@ if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra ${wdisabled}")
endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
# Version
set (project_VERSION_MAJOR "0")
set (project_VERSION_MINOR "1")
set (project_VERSION_PATCH "0")
set (project_VERSION "${project_VERSION_MAJOR}")
set (project_VERSION "${project_VERSION}.${project_VERSION_MINOR}")
set (project_VERSION "${project_VERSION}.${project_VERSION_PATCH}")
# Dependencies
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/liberty/cmake)
include (AddThreads)
@ -24,51 +15,31 @@ include (AddThreads)
find_package (PkgConfig REQUIRED)
pkg_check_modules (dependencies REQUIRED libpulse x11 xext xextproto dbus-1)
pkg_check_modules (gdm gdm glib-2.0 gio-2.0)
include_directories (${dependencies_INCLUDE_DIRS})
option (WITH_GDM "Compile with GDM support" ${gdm_FOUND})
set (project_libraries ${dependencies_LIBRARIES})
include_directories (${dependencies_INCLUDE_DIRS})
# Generate a configuration file
configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_BINARY_DIR})
# Build
add_executable (wmstatus wmstatus.c)
target_link_libraries (wmstatus ${project_libraries})
foreach (name brightness fancontrol-ng iexec input-switch priod siprandom)
add_executable (${name} ${name}.c)
endforeach (name)
foreach (name big-brother paswitch wmstatus)
add_executable (${name} ${name}.c)
target_link_libraries (${name} ${dependencies_LIBRARIES})
endforeach (name)
add_threads (wmstatus)
add_executable (paswitch paswitch.c)
target_link_libraries (paswitch ${project_libraries})
add_executable (brightness brightness.c)
target_link_libraries (brightness ${project_libraries})
add_executable (input-switch input-switch.c)
target_link_libraries (input-switch ${project_libraries})
add_executable (fancontrol-ng fancontrol-ng.c)
target_link_libraries (fancontrol-ng ${project_libraries})
add_executable (priod priod.c)
target_link_libraries (priod ${project_libraries})
add_executable (iexec iexec.c)
target_link_libraries (iexec)
if (WITH_GDM)
include_directories (${gdm_INCLUDE_DIRS})
add_executable (gdm-switch-user gdm-switch-user.c)
target_link_libraries (gdm-switch-user ${gdm_LIBRARIES})
endif (WITH_GDM)
add_executable (siprandom siprandom.c)
target_link_libraries (siprandom ${project_libraries})
add_executable (big-brother big-brother.c)
target_link_libraries (big-brother ${project_libraries})
# The files to be installed
include (GNUInstallDirs)
@ -106,16 +77,13 @@ set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Desktop tools")
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${project_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${project_VERSION_PATCH})
set (CPACK_GENERATOR "TGZ;ZIP")
set (CPACK_PACKAGE_FILE_NAME
"${PROJECT_NAME}-${project_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${project_VERSION}")
"${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${PROJECT_VERSION}")
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${project_VERSION}")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set (CPACK_SET_DESTDIR TRUE)
include (CPack)

View File

@ -2,7 +2,7 @@
#define CONFIG_H
#define PROGRAM_NAME "${PROJECT_NAME}"
#define PROGRAM_VERSION "${project_VERSION}"
#define PROGRAM_VERSION "${PROJECT_VERSION}"
#endif // ! CONFIG_H