Commit f122b8e7 authored by Ghislain MARY's avatar Ghislain MARY

Use bc_apply_compile_flags from bctoolbox CMake utils.

parent 98d0a05c
......@@ -65,21 +65,6 @@ option(CXX_WRAPPER "Build the C++ wrapper for Liblinphone." OFF)
set(CMAKE_CXX_STANDARD 11)
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()
if(ENABLE_STATIC)
set(LINPHONE_LIBS_FOR_TOOLS linphone-static)
else()
......
......@@ -29,7 +29,7 @@ set(LINPHONECSH_SOURCE_FILES
shell.c
)
apply_compile_flags(LINPHONEC_SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(LINPHONEC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
if(MSVC)
get_source_file_property(COMMANDS_C_COMPILE_FLAGS commands.c COMPILE_FLAGS)
set(COMMANDS_C_COMPILE_FLAGS "${COMMANDS_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings
......
......@@ -185,9 +185,9 @@ else()
list(APPEND LINPHONE_SOURCE_FILES_C vcard_stubs.c)
endif()
apply_compile_flags(LINPHONE_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(LINPHONE_SOURCE_FILES_CXX "CPP" "CXX")
apply_compile_flags(LINPHONE_SOURCE_FILES_OBJC "CPP" "OBJC")
bc_apply_compile_flags(LINPHONE_SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
bc_apply_compile_flags(LINPHONE_SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
bc_apply_compile_flags(LINPHONE_SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
if(ENABLE_STATIC)
add_library(linphone-static STATIC ${LINPHONE_HEADER_FILES} ${LINPHONE_PRIVATE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC})
......
......@@ -71,7 +71,7 @@ if (ENABLE_TOOLS)
file(GLOB EXECUTABLES_SOURCE RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
foreach(EXECUTABLE ${EXECUTABLES_SOURCE})
string(REPLACE ".c" "" EXECUTABLE_NAME ${EXECUTABLE})
apply_compile_flags(${EXECUTABLE} "CPP" "C")
bc_apply_compile_flags(${EXECUTABLE} STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(${EXECUTABLE_NAME} ${USE_BUNDLE} ${EXECUTABLE})
target_link_libraries(${EXECUTABLE_NAME} ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES})
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
......
......@@ -110,8 +110,8 @@ set(DAEMON_PIPETEST_SOURCE_FILES
daemon-pipetest.c
)
apply_compile_flags(DAEMON_SOURCE_FILES "CPP" "CXX")
apply_compile_flags(DAEMON_PIPETEST_SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(DAEMON_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
bc_apply_compile_flags(DAEMON_PIPETEST_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(linphone-daemon ${DAEMON_SOURCE_FILES})
target_include_directories(linphone-daemon PRIVATE ${CMAKE_CURRENT_LIST_DIR})
......
......@@ -84,8 +84,8 @@ if (APPLE)
list(APPEND OBJC_FILES mac.m)
endif()
apply_compile_flags(OBJC_FILES "CPP" "OBJC")
apply_compile_flags(SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(OBJC_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
bc_apply_compile_flags(SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
if(WIN32)
add_executable(linphone-gtk WIN32 ${SOURCE_FILES})
......
......@@ -196,8 +196,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(MSVC)
get_source_file_property(MESSAGE_TESTER_C_COMPILE_FLAGS message_tester.c COMPILE_FLAGS)
......
......@@ -44,31 +44,31 @@ set(LP_GEN_WRAPPERS_LIBS
${XML2_LIBRARIES}
)
apply_compile_flags(LP_GEN_WRAPPERS_SOURCE_FILES "CPP" "CXX")
bc_apply_compile_flags(LP_GEN_WRAPPERS_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
add_executable(lp-gen-wrappers ${USE_BUNDLE} ${LP_GEN_WRAPPERS_SOURCE_FILES})
target_link_libraries(lp-gen-wrappers ${LP_GEN_WRAPPERS_LIBS})
set_target_properties(lp-gen-wrappers PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set(LP_AUTO_ANSWER_SOURCE_FILES auto_answer.c)
apply_compile_flags(LP_AUTO_ANSWER_SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(LP_AUTO_ANSWER_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(lp-auto-answer ${USE_BUNDLE} ${LP_AUTO_ANSWER_SOURCE_FILES})
target_link_libraries(lp-auto-answer ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES})
set_target_properties(lp-auto-answer PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set(LP_SENDMSG_SOURCE_FILES lpsendmsg.c)
apply_compile_flags(LP_SENDMSG_SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(LP_SENDMSG_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(lp-sendmsg ${USE_BUNDLE} ${LP_SENDMSG_SOURCE_FILES})
target_link_libraries(lp-sendmsg ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
set_target_properties(lp-sendmsg PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set(LP_LPC2XML_TEST_SOURCE_FILES lpc2xml_test.c)
apply_compile_flags(LP_LPC2XML_TEST_SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(LP_LPC2XML_TEST_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(lpc2xml_test ${USE_BUNDLE} ${LP_LPC2XML_TEST_SOURCE_FILES})
target_link_libraries(lpc2xml_test ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
set_target_properties(lpc2xml_test PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set(LP_XML2LPC_TEST_SOURCE_FILES xml2lpc_test.c)
apply_compile_flags(LP_XML2LPC_TEST_SOURCE_FILES "CPP" "C")
bc_apply_compile_flags(LP_XML2LPC_TEST_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(xml2lpc_test ${USE_BUNDLE} ${LP_XML2LPC_TEST_SOURCE_FILES})
target_link_libraries(xml2lpc_test ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
set_target_properties(xml2lpc_test PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
......
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