snapcast/server/CMakeLists.txt
Felix Geyer f6f107af28 cmake: properly link against libatomic when needed
Similar to CMAKE_REQUIRED_FLAGS, CMAKE_CXX_LINK_FLAGS is not an
appropriate variable for linking against libraries.
2020-02-02 16:20:23 +01:00

77 lines
2.3 KiB
CMake

set(SERVER_SOURCES
config.cpp
control_server.cpp
control_session_tcp.cpp
control_session_http.cpp
snapserver.cpp
stream_server.cpp
stream_session.cpp
encoder/encoder_factory.cpp
encoder/pcm_encoder.cpp
streamreader/base64.cpp
streamreader/stream_uri.cpp
streamreader/stream_manager.cpp
streamreader/pcm_stream.cpp
streamreader/tcp_stream.cpp
streamreader/pipe_stream.cpp
streamreader/posix_stream.cpp
streamreader/file_stream.cpp
streamreader/airplay_stream.cpp
streamreader/librespot_stream.cpp
streamreader/watchdog.cpp
streamreader/process_stream.cpp)
set(SERVER_LIBRARIES
${CMAKE_THREAD_LIBS_INIT}
${ATOMIC_LIBRARY}
common)
set(SERVER_INCLUDE
${Boost_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/server
${CMAKE_SOURCE_DIR}/common)
# Avahi
if (AVAHI_FOUND)
list(APPEND SERVER_SOURCES publishZeroConf/publish_avahi.cpp)
list(APPEND SERVER_LIBRARIES ${AVAHI_LIBRARIES})
list(APPEND SERVER_INCLUDE ${AVAHI_INCLUDE_DIRS})
endif (AVAHI_FOUND)
if (BONJOUR_FOUND)
list(APPEND SERVER_SOURCES publishZeroConf/publish_bonjour.cpp)
# list(APPEND SERVER_LIBRARIES ${BONJOUR_LIBRARIES})
# list(APPEND SERVER_INCLUDE ${BONJOUR_INCLUDE_DIRS})
endif (BONJOUR_FOUND)
if (OGG_FOUND AND VORBIS_FOUND AND VORBISENC_FOUND)
list(APPEND SERVER_SOURCES encoder/ogg_encoder.cpp)
list(APPEND SERVER_LIBRARIES
${OGG_LIBRARIES}
${VORBIS_LIBRARIES}
${VORBISENC_LIBRARIES})
list(APPEND SERVER_INCLUDE
${OGG_INCLUDE_DIRS}
${VORBIS_INCLUDE_DIRS}
${VORBISENC_INCLUDE_DIRS})
endif (OGG_FOUND AND VORBIS_FOUND AND VORBISENC_FOUND)
if (FLAC_FOUND)
list(APPEND SERVER_SOURCES encoder/flac_encoder.cpp)
list(APPEND SERVER_LIBRARIES ${FLAC_LIBRARIES})
list(APPEND SERVER_INCLUDE ${FLAC_INCLUDE_DIRS})
endif (FLAC_FOUND)
if (OPUS_FOUND)
list(APPEND SERVER_SOURCES encoder/opus_encoder.cpp)
list(APPEND SERVER_LIBRARIES ${OPUS_LIBRARIES})
list(APPEND SERVER_INCLUDE ${OPUS_INCLUDE_DIRS})
endif (OPUS_FOUND)
#list(APPEND SERVER_LIBRARIES Boost::boost)
include_directories(${SERVER_INCLUDE})
add_executable(snapserver ${SERVER_SOURCES})
target_link_libraries(snapserver ${SERVER_LIBRARIES})
install(TARGETS snapserver COMPONENT server DESTINATION "${CMAKE_INSTALL_BINDIR}")