46 lines
1.8 KiB
CMake
46 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(chrony)
|
|
|
|
# Directories configuration
|
|
set(SYSCONFDIR "/etc")
|
|
set(BINDIR "/usr/local/bin")
|
|
set(SBINDIR "/usr/local/sbin")
|
|
set(LOCALSTATEDIR "/var")
|
|
set(CHRONYVARDIR "/var/lib/chrony")
|
|
set(DESTDIR "")
|
|
|
|
# Compiler and flags
|
|
set(CMAKE_C_FLAGS "-O2 -g -D_FORTIFY_SOURCE=2 -fPIE -fstack-protector-strong --param=ssp-buffer-size=4 -Wmissing-prototypes -Wall -pthread")
|
|
set(CMAKE_EXE_LINKER_FLAGS "-pie -Wl,-z,relro,-z,now")
|
|
|
|
# Targets
|
|
add_executable(chronyd
|
|
sys_generic.c sys_linux.c sys_timex.c sys_posix.c cmdmon.c manual.c pktlength.c ntp_auth.c ntp_core.c ntp_ext.c ntp_io.c
|
|
ntp_sources.c addrfilt.c clientlog.c keys.c nameserv.c refclock.c refclock_phc.c refclock_pps.c refclock_shm.c
|
|
refclock_sock.c nameserv_async.c hwclock.c ntp_io_linux.c rtc_linux.c hash_intmd5.c cmac_gnutls.c
|
|
nts_ntp_client.c
|
|
array.c cmdparse.c conf.c leapdb.c local.c logging.c main.c memory.c quantiles.c reference.c regress.c rtc.c samplefilt.c
|
|
sched.c socket.c sources.c sourcestats.c stubs.c smooth.c sys.c sys_null.c tempcomp.c util.c
|
|
nts_ntp_auth.c siv_gnutls.c nts_ke_client.c nts_ke_session.c nts_ntp_server.c nts_ke_server.c
|
|
)
|
|
add_executable(chronyc
|
|
array.c client.c cmdparse.c getdate.c memory.c nameserv.c pktlength.c socket.c util.c hash_intmd5.c cmac_gnutls.c)
|
|
|
|
# Libraries
|
|
target_link_libraries(chronyd m gnutls)
|
|
target_link_libraries(chronyc m edit gnutls)
|
|
|
|
# Install commands
|
|
install(TARGETS chronyd DESTINATION ${DESTDIR}${SBINDIR})
|
|
install(TARGETS chronyc DESTINATION ${DESTDIR}${BINDIR})
|
|
|
|
# Docs
|
|
add_custom_target(docs
|
|
COMMAND ${CMAKE_MAKE_PROGRAM} -C doc docs
|
|
COMMENT "Building documentation"
|
|
)
|
|
|
|
add_custom_target(install-docs
|
|
COMMAND ${CMAKE_MAKE_PROGRAM} -C doc install-docs
|
|
COMMENT "Installing documentation"
|
|
)
|