Commit c42daca7 authored by Ghislain MARY's avatar Ghislain MARY

Use bc_apply_compile_flags from bctoolbox CMake utils.

parent 4f9c2afd
......@@ -108,21 +108,6 @@ cmake_dependent_option(ENABLE_QNX "Build medistreamer2 with BB10 filters." NO "E
cmake_dependent_option(ENABLE_VT_H264 "Build mediastreamer2 with H264 encoder/decoder based on VirtualToolbox (Apple only)" YES "ENABLE_VIDEO" NO)
option(ENABLE_JPEG "Enable JPEG support" YES)
macro(apply_compile_flags SOURCE_FILES)
if(${SOURCE_FILES})
set(options "")
foreach(a ${ARGV})
if(STRICT_OPTIONS_${a})
string(REPLACE ";" " " options_${a} "${STRICT_OPTIONS_${a}}")
set(options "${options} ${options_${a}}")
endif()
endforeach()
if(options)
set_source_files_properties(${${SOURCE_FILES}} PROPERTIES COMPILE_FLAGS "${options}")
endif()
endif()
endmacro()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
......
......@@ -86,7 +86,7 @@ if(HAVE_DLOPEN)
list(APPEND BASE_LIBS dl)
endif()
apply_compile_flags(BASE_SOURCE_FILES_C "CPP" "C")
bc_apply_compile_flags(BASE_SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
if(ENABLE_STATIC)
add_library(mediastreamer_base-static STATIC ${MEDIASTREAMER2_HEADER_FILES} ${BASE_SOURCE_FILES_C})
......@@ -481,11 +481,11 @@ if(APPLE OR ANDROID OR OPENGL_FOUND OR GLX_FOUND OR QTANGLE_FOUND)
)
endif()
apply_compile_flags(VOIP_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(VOIP_SOURCE_FILES_OBJC "CPP" "OBJC")
bc_apply_compile_flags(VOIP_SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
bc_apply_compile_flags(VOIP_SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
if(VOIP_SOURCE_FILES_CXX)
set_source_files_properties(${VOIP_SOURCE_FILES_CXX} PROPERTIES LANGUAGE CXX)
apply_compile_flags(VOIP_SOURCE_FILES_CXX "CPP" "CXX")
bc_apply_compile_flags(VOIP_SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
endif()
......
......@@ -105,8 +105,8 @@ if(APPLE)
endif()
endif()
apply_compile_flags(SOURCE_FILES_C "CPP" "C")
apply_compile_flags(SOURCE_FILES_OBJC "CPP" "OBJC")
bc_apply_compile_flags(SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
bc_apply_compile_flags(SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
......
......@@ -42,7 +42,7 @@ if(ENABLE_VIDEO)
endif()
foreach(simple_executable ${simple_executables})
set(${simple_executable}_SOURCE_FILES ${simple_executable}.c)
apply_compile_flags(${simple_executable}_SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(${simple_executable}_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(${simple_executable} ${USE_BUNDLE} ${simple_executable}.c)
target_link_libraries(${simple_executable} ${MS2_LIBS_FOR_TOOLS})
if(LINK_FLAGS_STR)
......@@ -60,7 +60,7 @@ endif()
if(PCAP_FOUND)
set(PCAP_PLAYBACK_SOURCE_FILES pcap_playback.c common.c)
apply_compile_flags(PCAP_PLAYBACK_SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(PCAP_PLAYBACK_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(pcap_playback ${USE_BUNDLE} ${PCAP_PLAYBACK_SOURCE_FILES})
target_link_libraries(pcap_playback ${MS2_LIBS_FOR_TOOLS} ${PCAP_LIBRARIES})
target_include_directories(pcap_playback PUBLIC ${PCAP_INCLUDE_DIRS})
......@@ -75,8 +75,8 @@ if (NOT IOS)
if(APPLE)
list(APPEND MEDIASTREAM_SOURCE_FILES_OBJC mediastream_cocoa.m)
endif()
apply_compile_flags(MEDIASTREAM_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(MEDIASTREAM_SOURCE_FILES_OBJC "CPP" "OBJC")
bc_apply_compile_flags(MEDIASTREAM_SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
bc_apply_compile_flags(MEDIASTREAM_SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
add_executable(mediastream ${USE_BUNDLE} ${MEDIASTREAM_SOURCE_FILES_C} ${MEDIASTREAM_SOURCE_FILES_OBJC})
target_link_libraries(mediastream ${MS2_LIBS_FOR_TOOLS})
if(LINK_FLAGS_STR)
......@@ -86,7 +86,7 @@ endif()
if(ENABLE_VIDEO)
set(MKVSTREAM_SOURCE_FILES mkvstream.c)
apply_compile_flags(MKVSTREAM_SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(MKVSTREAM_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(mkvstream ${USE_BUNDLE} ${MKVSTREAM_SOURCE_FILES})
target_link_libraries(mkvstream ${MS2_LIBS_FOR_TOOLS})
if(LINK_FLAGS_STR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment