# Copyright (C) 2024 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)

if(CMAKE_CXX_STANDARD VERSION_LESS 20)
    set(utils_libs Threads::Threads fmt::fmt)
else()
    set(utils_libs Threads::Threads)
endif()

if(BUILD_IPC)
add_executable(bordeauxctl bordeauxctl.cpp ${headers} bordeauxctl.1)
target_link_libraries(bordeauxctl ${utils_libs})
endif()

add_executable(bordeauxsnd bordeauxsnd.cpp ${headers} bordeauxsnd.1)
target_link_libraries(bordeauxsnd ${utils_libs} ${FLITE_LIBRARIES} m)

if(BUILD_IPC)
install(TARGETS bordeauxctl bordeauxsnd DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES ${man} DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
endif()
