# Copyright (C) 2021 Tycho Softworks.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

file(GLOB man *.1)
set(utils_libs Threads::Threads fmt::fmt)

add_executable(pbx-message pbx-message.cpp pbx-message.1)
target_link_libraries(pbx-message PRIVATE ${utils_libs})

add_executable(pbx-presence pbx-presence.cpp pbx-presence.1)
target_link_libraries(pbx-presence PRIVATE ${utils_libs})

add_executable(pbx-registry pbx-registry.cpp pbx-registry.1)
target_link_libraries(pbx-registry PRIVATE ${utils_libs})

add_executable(pbx-realm pbx-realm.cpp pbx-realm.1)
target_link_libraries(pbx-realm PRIVATE ${utils_libs})

add_executable(pbx-status pbx-status.cpp pbx-status.1)
target_link_libraries(pbx-status PRIVATE ${utils_libs})

add_executable(pbx-runstate pbx-runstate.cpp pbx-runstate.1)
target_link_libraries(pbx-runstate PRIVATE ${utils_libs})

add_executable(pbx-passwd pbx-passwd.cpp pbx-passwd.1)
target_link_libraries(pbx-passwd PRIVATE OpenSSL::Crypto ${utils_libs})

add_executable(pbx-ping pbx-ping.cpp pbx-ping.1)
target_link_libraries(pbx-ping PRIVATE ${EXOSIP_LIBS} ${utils_libs})

install(TARGETS pbx-message pbx-presence pbx-realm pbx-runstate pbx-status pbx-registry pbx-passwd pbx-ping DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES ${man} DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
