CMakeLists.txt 3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
############################################################################
# CMakeLists.txt
# Copyright (C) 2015  Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
############################################################################

23
set(simple_executables bench ring mtudiscover tones)
24
if(ENABLE_VIDEO)
25 26
	list(APPEND simple_executables videodisplay test_x11window)
endif()
27
foreach(simple_executable ${simple_executables})
28 29
	set(${simple_executable}_SOURCE_FILES ${simple_executable}.c)
	apply_compile_flags(${simple_executable}_SOURCE_FILES "CPP" "C")
30 31 32 33
	add_executable(${simple_executable} ${simple_executable}.c)
	target_link_libraries(${simple_executable} mediastreamer_voip mediastreamer_base)
endforeach()

34 35 36
set(ECHO_SOURCE_FILES echo.c)
apply_compile_flags(ECHO_SOURCE_FILES "CPP" "C")
add_executable(ms-echo ${ECHO_SOURCE_FILES}) # Do not name the target "echo" to avoid conflict with the shell echo command
37 38
target_link_libraries(ms-echo mediastreamer_voip mediastreamer_base)

39
if(PCAP_FOUND)
40 41 42
	set(PCAP_PLAYBACK_SOURCE_FILES pcap_playback.c common.c)
	apply_compile_flags(PCAP_PLAYBACK_SOURCE_FILES "CPP" "C")
	add_executable(pcap_playback ${PCAP_PLAYBACK_SOURCE_FILES})
43
	target_link_libraries(pcap_playback mediastreamer_voip mediastreamer_base ${PCAP_LIBRARIES})
44 45 46
	target_include_directories(pcap_playback PUBLIC ${PCAP_INCLUDE_DIRS})
endif()

47 48
set(MEDIASTREAM_SOURCE_FILES_C mediastream.c common.c)
set(MEDIASTREAM_SOURCE_FILES_OBJC )
49
if(APPLE)
50
	list(APPEND MEDIASTREAM_SOURCE_FILES_OBJC mediastream_cocoa.m)
51
endif()
52 53 54
apply_compile_flags(MEDIASTREAM_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(MEDIASTREAM_SOURCE_FILES_OBJC "CPP" "OBJC")
add_executable(mediastream ${MEDIASTREAM_SOURCE_FILES_C} ${MEDIASTREAM_SOURCE_FILES_OBJC})
55
target_link_libraries(mediastream mediastreamer_voip mediastreamer_base)
56
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
57
if(LINK_FLAGS_STR)
58
	set_target_properties(mediastream PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
59
endif()
60

61
if(ENABLE_VIDEO)
62 63 64
	set(MKVSTREAM_SOURCE_FILES mkvstream.c)
	apply_compile_flags(MKVSTREAM_SOURCE_FILES "CPP" "C")
	add_executable(mkvstream ${MKVSTREAM_SOURCE_FILES})
65
	target_link_libraries(mkvstream mediastreamer_voip mediastreamer_base)
66

67 68 69 70
	install(TARGETS mediastream mkvstream
		RUNTIME DESTINATION bin
	)
endif()