cmake_minimum_required(VERSION 3.5) include(GNUInstallDirs) project(timemanager) add_definitions( -Wall -Werror ) set(TIMEMGR_WRITABLE_DIR "/var/fs/shared/settings/timemanager" CACHE STRING "Writable data directory") set(TIMEMGR_ZONEINFO_DIR "/var/fs/shared/zoneinfo" CACHE STRING "Custom timezone directory") set(TIMEMGR_ZONEINFO_FILE "${TIMEMGR_ZONEINFO_DIR}/Lexmark_Custom" CACHE STRING "Custom timezone file") set(TIMEMGR_VALIDTIME_FILE "${TIMEMGR_WRITABLE_DIR}/lastvalidtime" CACHE STRING "Last valid time file") configure_file(foo.h.in foo.h @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}) find_package(PkgConfig) pkg_check_modules(LIBSYSTEMD REQUIRED libsystemd) pkg_check_modules(GLIB REQUIRED glib-2.0) pkg_check_modules(GIO REQUIRED gio-2.0) pkg_check_modules(REMOTEOBJECTS REQUIRED remoteobjects) pkg_check_modules(REMOTESETTINGS REQUIRED remotesettings) pkg_check_modules(SETTINGSAPI REQUIRED settingsapi) pkg_check_modules(STATUSAPI REQUIRED statusapi) include_directories( ${LIBSYSTEMD_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${REMOTEOBJECTS_INCLUDE_DIRS} ${REMOTESETTINGS_INCLUDE_DIRS} ${SETTINGSAPI_INCLUDE_DIRS} ${STATUSAPI_INCLUDE_DIRS} ) link_directories( ${LIBSYSTEMD_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${GIO_LIBRARY_DIRS} ${REMOTEOBJECTS_LIBRARY_DIRS} ${REMOTESETTINGS_LIBRARY_DIRS} ${SETTINGSAPI_LIBRARY_DIRS} ${STATUSAPI_LIBRARY_DIRS} ) add_executable(validate_zoneinfo validate_zoneinfo.c) add_executable(timemgrd timemgrd.c timemgr_cache.c timemgr_chrony.c timemgr_dbus.c timemgr_rob.c tzfile.c zoneinfo.c ) target_link_libraries(timemgrd ${LIBSYSYTEMD_LIBRARIES} ${GLIB_LIBRARIES} ${GIO_LIBRARIES} ${REMOTESETTINGS_LIBRARIES} ${REMOTEOBJECTS_LIBRARIES} ${STATUSAPI_LIBRARIES} add_library(settings_timemgr timemgr_settings.c) install(TARGETS validate_zoneinfo timemgrd settings_timemgr RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/settings ) install(FILES timemgr.service DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/system)