Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
95cbe2f5
Commit
95cbe2f5
authored
Oct 30, 2015
by
Ghislain MARY
Browse files
Handle strict compilation options with CMake.
parent
0e32b37a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
8 deletions
+30
-8
CMakeLists.txt
CMakeLists.txt
+19
-2
src/CMakeLists.txt
src/CMakeLists.txt
+4
-4
tester/CMakeLists.txt
tester/CMakeLists.txt
+1
-0
tools/CMakeLists.txt
tools/CMakeLists.txt
+6
-2
No files found.
CMakeLists.txt
View file @
95cbe2f5
...
...
@@ -63,6 +63,7 @@ option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
option
(
ENABLE_FIXED_POINT
"Turn on fixed point computations."
${
ENABLE_FIXED_POINT_DEFAULT_VALUE
}
)
option
(
ENABLE_NON_FREE_CODECS
"Allow inclusion of non-free codecs in the build."
NO
)
option
(
ENABLE_PCAP
"Enable PCAP support."
NO
)
option
(
ENABLE_STRICT
"Build with strict compile options."
YES
)
option
(
ENABLE_RELATIVE_PREFIX
"Find resources relatively to the installation directory."
NO
)
option
(
ENABLE_TOOLS
"Turn on or off compilation of tools."
YES
)
option
(
ENABLE_UNIT_TESTS
"Enable compilation of unit tests."
YES
)
...
...
@@ -443,13 +444,29 @@ if(APPLE)
list
(
APPEND LINK_FLAGS
"-framework Cocoa"
"-framework OpenGL"
"-framework QuartzCore"
"-framework QTKit"
)
endif
()
set
(
PLUGINS_EXT
".dylib"
)
add_definitions
(
-DTARGET_OS_MAC=1
)
add_definitions
(
"
-DTARGET_OS_MAC=1
"
)
endif
()
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/mediastreamer-config.h.cmake
${
CMAKE_CURRENT_BINARY_DIR
}
/mediastreamer-config.h
)
set_source_files_properties
(
${
CMAKE_CURRENT_BINARY_DIR
}
/mediastreamer-config.h PROPERTIES GENERATED ON
)
add_definitions
(
-DHAVE_CONFIG_H
)
add_definitions
(
"
-DHAVE_CONFIG_H
"
)
add_definitions
(
${
ORTP_CPPFLAGS
}
)
set
(
STRICT_OPTIONS_CPP
)
set
(
STRICT_OPTIONS_C
)
if
(
NOT MSVC
)
list
(
APPEND STRICT_OPTIONS_CPP
"-Wall"
"-Wuninitialized"
)
list
(
APPEND STRICT_OPTIONS_C
"-Wdeclaration-after-statement"
)
if
(
CMAKE_C_COMPILER_ID STREQUAL
"Clang"
)
list
(
APPEND STRICT_OPTIONS_CPP
"-Qunused-arguments"
"-Wno-unused-function"
"-Wno-array-bounds"
)
endif
()
if
(
APPLE
)
list
(
APPEND STRICT_OPTIONS_CPP
"-Wno-error=unknown-warning-option"
"-Wno-tautological-compare"
)
endif
()
if
(
ENABLE_STRICT
)
list
(
APPEND STRICT_OPTIONS_CPP
"-Werror"
"-fno-strict-aliasing"
)
endif
()
endif
()
if
(
LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS
)
set
(
EXPORT_TARGETS_NAME
"LinphoneBuilder"
)
...
...
src/CMakeLists.txt
View file @
95cbe2f5
...
...
@@ -81,11 +81,9 @@ endif()
if
(
ENABLE_STATIC
)
add_library
(
mediastreamer_base STATIC
${
MEDIASTREAMER2_HEADER_FILES
}
${
BASE_SOURCE_FILES
}
${
BASE_GENERATED_SOURCE_FILES
}
)
target_link_libraries
(
mediastreamer_base
${
BASE_LIBS
}
)
else
()
add_library
(
mediastreamer_base SHARED
${
MEDIASTREAMER2_HEADER_FILES
}
${
BASE_SOURCE_FILES
}
${
BASE_GENERATED_SOURCE_FILES
}
)
set_target_properties
(
mediastreamer_base PROPERTIES VERSION
${
MEDIASTREAMER_SO_VERSION
}
LINKER_LANGUAGE C
)
target_link_libraries
(
mediastreamer_base
${
BASE_LIBS
}
)
if
(
MSVC
)
if
(
CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/Debug/mediastreamer_base.pdb
...
...
@@ -95,6 +93,8 @@ else()
endif
()
endif
()
endif
()
target_link_libraries
(
mediastreamer_base
${
BASE_LIBS
}
)
target_compile_options
(
mediastreamer_base PRIVATE
${
STRICT_OPTIONS_CPP
}
${
STRICT_OPTIONS_C
}
)
install
(
TARGETS mediastreamer_base EXPORT
${
EXPORT_TARGETS_NAME
}
Targets
RUNTIME DESTINATION bin
...
...
@@ -438,11 +438,9 @@ endif()
if
(
ENABLE_STATIC
)
add_library
(
mediastreamer_voip STATIC
${
MEDIASTREAMER2_HEADER_FILES
}
${
VOIP_SOURCE_FILES
}
${
VOIP_GENERATED_SOURCE_FILES
}
)
target_link_libraries
(
mediastreamer_voip
${
VOIP_LIBS
}
)
else
()
add_library
(
mediastreamer_voip SHARED
${
MEDIASTREAMER2_HEADER_FILES
}
${
VOIP_SOURCE_FILES
}
${
VOIP_GENERATED_SOURCE_FILES
}
)
set_target_properties
(
mediastreamer_voip PROPERTIES VERSION
${
MEDIASTREAMER_SO_VERSION
}
LINKER_LANGUAGE CXX
)
target_link_libraries
(
mediastreamer_voip
${
VOIP_LIBS
}
)
if
(
MSVC
)
if
(
CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/Debug/mediastreamer_voip.pdb
...
...
@@ -452,6 +450,8 @@ else()
endif
()
endif
()
endif
()
target_link_libraries
(
mediastreamer_voip
${
VOIP_LIBS
}
)
target_compile_options
(
mediastreamer_voip PRIVATE
${
STRICT_OPTIONS_CPP
}
${
STRICT_OPTIONS_C
}
)
string
(
REPLACE
";"
" "
LINK_FLAGS_STR
"
${
LINK_FLAGS
}
"
)
if
(
LINK_FLAGS_STR
)
set_target_properties
(
mediastreamer_voip PROPERTIES LINK_FLAGS
"
${
LINK_FLAGS_STR
}
"
)
...
...
tester/CMakeLists.txt
View file @
95cbe2f5
...
...
@@ -46,6 +46,7 @@ endif()
add_executable
(
mediastreamer2_tester
${
SOURCE_FILES
}
)
target_include_directories
(
mediastreamer2_tester PUBLIC
${
CUNIT_INCLUDE_DIRS
}
PRIVATE common
)
target_link_libraries
(
mediastreamer2_tester mediastreamer_voip mediastreamer_base
${
CUNIT_LIBRARIES
}
)
target_compile_options
(
mediastreamer2_tester PRIVATE
${
STRICT_OPTIONS_CPP
}
${
STRICT_OPTIONS_C
}
)
string
(
REPLACE
";"
" "
LINK_FLAGS_STR
"
${
LINK_FLAGS
}
"
)
if
(
NOT
"
${
LINK_FLAGS_STR
}
"
STREQUAL
""
)
set_target_properties
(
mediastreamer2_tester PROPERTIES LINK_FLAGS
"
${
LINK_FLAGS_STR
}
"
)
...
...
tools/CMakeLists.txt
View file @
95cbe2f5
...
...
@@ -27,16 +27,18 @@ endif()
foreach
(
simple_executable
${
simple_executables
}
)
add_executable
(
${
simple_executable
}
${
simple_executable
}
.c
)
target_link_libraries
(
${
simple_executable
}
mediastreamer_voip mediastreamer_base
)
target_compile_options
(
${
simple_executable
}
PRIVATE
${
STRICT_OPTIONS_CPP
}
${
STRICT_OPTIONS_C
}
)
endforeach
()
add_executable
(
ms-echo echo.c
)
#to avoid conflict with bash command
target_link_libraries
(
ms-echo mediastreamer_voip mediastreamer_base
)
target_compile_options
(
ms-echo PRIVATE
${
STRICT_OPTIONS_CPP
}
${
STRICT_OPTIONS_C
}
)
if
(
PCAP_FOUND
)
add_executable
(
pcap_playback pcap_playback.c common.c
)
target_link_libraries
(
pcap_playback mediastreamer_voip mediastreamer_base
)
target_link_libraries
(
pcap_playback mediastreamer_voip mediastreamer_base
${
PCAP_LIBRARIES
}
)
target_include_directories
(
pcap_playback PUBLIC
${
PCAP_INCLUDE_DIRS
}
)
target_
link_librarie
s
(
pcap_playback
${
PCAP_LIBRARIES
}
)
target_
compile_option
s
(
pcap_playback
PRIVATE
${
STRICT_OPTIONS_CPP
}
${
STRICT_OPTIONS_C
}
)
endif
()
set
(
MEDIASTREAM_SOURCE_FILES mediastream.c common.c
)
...
...
@@ -45,6 +47,7 @@ if(APPLE)
endif
()
add_executable
(
mediastream
${
MEDIASTREAM_SOURCE_FILES
}
)
target_link_libraries
(
mediastream mediastreamer_voip mediastreamer_base
)
target_compile_options
(
mediastream PRIVATE
${
STRICT_OPTIONS_CPP
}
${
STRICT_OPTIONS_C
}
)
string
(
REPLACE
";"
" "
LINK_FLAGS_STR
"
${
LINK_FLAGS
}
"
)
if
(
NOT
"
${
LINK_FLAGS_STR
}
"
STREQUAL
""
)
set_target_properties
(
mediastream PROPERTIES LINK_FLAGS
"
${
LINK_FLAGS_STR
}
"
)
...
...
@@ -53,6 +56,7 @@ endif()
if
(
ENABLE_VIDEO
)
add_executable
(
mkvstream mkvstream.c
)
target_link_libraries
(
mkvstream mediastreamer_voip mediastreamer_base
)
target_compile_options
(
mkvstream PRIVATE
${
STRICT_OPTIONS_CPP
}
${
STRICT_OPTIONS_C
}
)
install
(
TARGETS mediastream mkvstream
RUNTIME DESTINATION bin
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment