...
 
Commits (5)
......@@ -20,7 +20,7 @@
#
############################################################################
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.1)
project(linphone VERSION 3.12.0 LANGUAGES C CXX)
......@@ -103,13 +103,8 @@ endif()
# find_package should be invoked here to check for libraries - however do NOT
# call include_directories here (see below)
if (ENABLE_VCARD)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_belcard_CONFIG_DIR}/BelcardConfig.cmake")
else()
find_package(Belcard)
endif()
find_package(belcard CONFIG)
if(NOT BELCARD_FOUND)
message(WARNING "Could not find the belcard library!")
set(ENABLE_VCARD OFF CACHE BOOL "Enable vcard support." FORCE)
......@@ -118,27 +113,18 @@ if (ENABLE_VCARD)
endif()
endif()
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_bellesip_CONFIG_DIR}/BelleSIPConfig.cmake")
include("${EP_ms2_CONFIG_DIR}/Mediastreamer2Config.cmake")
include("${EP_ortp_CONFIG_DIR}/ORTPConfig.cmake")
set(BcToolbox_FIND_COMPONENTS tester)
include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake")
include("${EP_belr_CONFIG_DIR}/BelrConfig.cmake")
else()
find_package(BelleSIP REQUIRED)
find_package(Mediastreamer2 REQUIRED)
find_package(ORTP REQUIRED)
find_package(BcToolbox 0.0.3 REQUIRED OPTIONAL_COMPONENTS tester)
find_package(Belr REQUIRED)
endif()
find_package(BelleSIP CONFIG REQUIRED)
find_package(Mediastreamer2 CONFIG REQUIRED)
find_package(ortp CONFIG REQUIRED)
find_package(bctoolbox 0.0.3 CONFIG REQUIRED OPTIONAL_COMPONENTS tester)
find_package(belr CONFIG REQUIRED)
find_package(LibXsd REQUIRED)
find_package(Sqlite3 REQUIRED)
find_package(XML2 REQUIRED)
#APPLE platform does not use dlopen for soci backend
if (APPLE)
if (APPLE)
find_package(Soci REQUIRED COMPONENTS sqlite3)
else()
find_package(Soci REQUIRED)
......@@ -174,16 +160,12 @@ if(ENABLE_LIME AND ENABLE_LIME_X3DH)
set(ENABLE_LIME FALSE)
endif()
if(ENABLE_LIME_X3DH)
find_package(Lime REQUIRED)
find_package(lime REQUIRED CONFIG)
set(HAVE_LIME_X3DH TRUE)
endif()
if(ENABLE_LIME)
if(ENABLE_LIME OR ENABLE_LIME_X3DH)
#bzrtp is only required for LIME
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_bzrtp_CONFIG_DIR}/BZRTPConfig.cmake")
else()
find_package(BZRTP REQUIRED)
endif()
find_package(bzrtp REQUIRED CONFIG)
set(HAVE_LIME 1)
endif()
if(ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_JAVA_WRAPPER OR ENABLE_DOC)
......@@ -212,7 +194,9 @@ if(NOT WIN32)
endif()
if(ANDROID)
find_package(CpuFeatures REQUIRED)
find_package(Support)
if(CMAKE_ANDROID_NDK_VERSION VERSION_LESS 19)
find_library(ANDROID_SUPPORT_LIBRARY NAMES support)
endif()
endif()
set(LINPHONE_LDFLAGS "${BELLESIP_LDFLAGS} ${MEDIASTREAMER2_LDFLAGS}")
......@@ -220,30 +204,25 @@ set(LINPHONE_LDFLAGS "${BELLESIP_LDFLAGS} ${MEDIASTREAMER2_LDFLAGS}")
# include_directories must be called only UNDER THIS LINE in order to use our
# projects submodules first (we do NOT want to have system headers in first position)
include_directories(
coreapi
include
src
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/coreapi/
coreapi/
include/
src/
)
set(LINPHONE_INCLUDE_DIRS
${BELLESIP_INCLUDE_DIRS}
${MEDIASTREAMER2_INCLUDE_DIRS}
${BCTOOLBOX_CORE_INCLUDE_DIRS}
${BELR_INCLUDE_DIRS}
${BELLESIP_INCLUDE_DIRS}
${MEDIASTREAMER2_INCLUDE_DIRS}
${BCTOOLBOX_CORE_INCLUDE_DIRS}
${BELR_INCLUDE_DIRS}
)
if (BZRTP_FOUND)
list(APPEND LINPHONE_INCLUDE_DIRS ${BZRTP_INCLUDE_DIRS})
endif()
if(ANDROID)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/java)
endif()
if(ENABLE_TUNNEL)
list(APPEND LINPHONE_INCLUDE_DIRS ${TUNNEL_INCLUDE_DIRS})
endif()
if (ENABLE_VCARD)
list(APPEND LINPHONE_INCLUDE_DIRS ${BELCARD_INCLUDE_DIRS})
endif()
list(APPEND LINPHONE_INCLUDE_DIRS ${XML2_INCLUDE_DIRS})
list(APPEND LINPHONE_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIRS})
......@@ -342,15 +321,18 @@ else()
set(LINPHONE_DATA_DIR "${CMAKE_INSTALL_PREFIX}")
endif()
set(LINPHONE_PLUGINS_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_LIBDIR}/liblinphone/plugins")
if(WIN32)
set(LINPHONE_CONFIG_DIR "Linphone")
endif()
set(PACKAGE_LOCALE_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}/locale")
set(PACKAGE_DATA_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}")
set(PACKAGE_GRAMMAR_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}/belr/grammars")
set(PACKAGE_SOUND_DIR "${LINPHONE_DATA_DIR}/${CMAKE_INSTALL_DATADIR}/sounds/linphone")
set(PACKAGE_RING_DIR "${PACKAGE_SOUND_DIR}/rings")
set(PACKAGE_FREEDESKTOP_DIR "${PACKAGE_DATA_DIR}/applications")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/config.h PROPERTIES GENERATED ON)
add_definitions(-DHAVE_CONFIG_H)
......@@ -360,7 +342,6 @@ if(ENABLE_VIDEO)
add_definitions(-DVIDEO_ENABLED)
endif()
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(EXPORT_TARGETS_NAME "LinphoneBuilder")
else()
......@@ -384,7 +365,7 @@ endif()
if(ENABLE_TOOLS)
add_subdirectory(tools)
endif()
if(ENABLE_UNIT_TESTS AND BCTOOLBOX_TESTER_FOUND)
if(ENABLE_UNIT_TESTS)
add_subdirectory(tester)
endif()
if(ENABLE_CXX_WRAPPER)
......@@ -395,6 +376,8 @@ if(ENABLE_CSHARP_WRAPPER)
endif()
include(CMakePackageConfigHelpers)
set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/Linphone/cmake")
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfigVersion.cmake"
VERSION ${LINPHONE_VERSION}
......@@ -403,12 +386,12 @@ write_basic_package_version_file(
export(EXPORT ${EXPORT_TARGETS_NAME}Targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/LinphoneTargets.cmake"
)
configure_file(cmake/LinphoneConfig.cmake.in
configure_package_config_file(cmake/LinphoneConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfig.cmake"
@ONLY
INSTALL_DESTINATION ${CONFIG_PACKAGE_LOCATION}
NO_SET_AND_CHECK_MACRO
)
set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/Linphone/cmake")
install(EXPORT ${EXPORT_TARGETS_NAME}Targets
FILE LinphoneTargets.cmake
DESTINATION ${CONFIG_PACKAGE_LOCATION}
......
......@@ -26,8 +26,7 @@
# LIBXSD_INCLUDE_DIRS - the libxsd include directory
# LIBXSD_LIBRARIES - The libraries needed to use libxsd
find_package(XercesC)
find_library(XercesC_LIBRARIES XercesC NAMES xerces-c PATHS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
find_path(LIBXSD_INCLUDE_DIRS
NAMES xsd/cxx/config.hxx
......@@ -37,6 +36,7 @@ find_path(LIBXSD_INCLUDE_DIRS
if(LIBXSD_INCLUDE_DIRS)
list(APPEND LIBXSD_INCLUDE_DIRS ${XercesC_INCLUDE_DIRS})
endif()
set(LIBXSD_LIBRARIES ${XercesC_LIBRARIES})
include(FindPackageHandleStandardArgs)
......
......@@ -29,19 +29,16 @@
# LINPHONE_CPPFLAGS - The compilation flags needed to use linphone
# LINPHONE_LDFLAGS - The linking flags needed to use linphone
if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${CMAKE_CURRENT_LIST_DIR}/LinphoneTargets.cmake")
endif()
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_ms2_CONFIG_DIR}/Mediastreamer2Config.cmake")
include("${EP_bellesip_CONFIG_DIR}/BelleSIPConfig.cmake")
else()
find_package(Mediastreamer2 REQUIRED)
find_package(BelleSIP REQUIRED)
endif()
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/LinphoneTargets.cmake")
set(LINPHONE_TARGETNAME linphone)
find_package(Mediastreamer2 REQUIRED)
find_package(BelleSIP REQUIRED)
if(@ENABLE_SHARED@)
set(LINPHONE_TARGETNAME linphone)
set(LINPHONE_LIBRARIES ${LINPHONE_TARGETNAME})
else()
set(LINPHONE_TARGETNAME linphone-static)
......@@ -58,12 +55,8 @@ else()
endif()
endif()
get_target_property(LINPHONE_INCLUDE_DIRS ${LINPHONE_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
list(INSERT LINPHONE_INCLUDE_DIRS 0 "${EP_linphone_INCLUDE_DIR}")
else()
list(INSERT LINPHONE_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
endif()
list(REMOVE_DUPLICATES LINPHONE_INCLUDE_DIRS)
set_target_properties(${LINPHONE_TARGETNAME} PROPERTIES INTERFACE_LINK_LIBRARIES "@INTERFACE_LIBS@")
set(LINPHONE_CPPFLAGS @LINPHONE_CPPFLAGS@)
set(LINPHONE_LDFLAGS "@LINPHONE_LDFLAGS@")
......
......@@ -37,7 +37,7 @@ if(MSVC)
endif()
add_executable(linphonec ${LINPHONEC_SOURCE_FILES})
target_link_libraries(linphonec ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${XSD_LIBRARIES})
target_link_libraries(linphonec ${LINPHONE_LIBS_FOR_TOOLS} bctoolbox ortp mediastreamer ${XSD_LIBRARIES})
set_target_properties(linphonec PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(linphonec PROPERTIES LINKER_LANGUAGE CXX)
......@@ -47,14 +47,14 @@ endif()
if(WIN32)
add_executable(linphoned WIN32 ${LINPHONEC_SOURCE_FILES})
target_link_libraries(linphoned ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${XSD_LIBRARIES})
target_link_libraries(linphoned ${LINPHONE_LIBS_FOR_TOOLS} bctoolbox ortp mediastreamer ${XSD_LIBRARIES})
if(INTL_FOUND)
target_link_libraries(linphoned ${INTL_LIBRARIES})
endif()
endif()
add_executable(linphonecsh ${LINPHONECSH_SOURCE_FILES})
target_link_libraries(linphonecsh ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES})
target_link_libraries(linphonecsh ${LINPHONE_LIBS_FOR_TOOLS} bctoolbox ortp)
set_target_properties(linphonecsh PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(linphonecsh PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -118,13 +118,13 @@ 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})
target_link_libraries(linphone-daemon ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES} ${XSD_LIBRARIES})
target_include_directories(linphone-daemon PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(linphone-daemon ${LINPHONE_LIBS_FOR_TOOLS} mediastreamer ortp bctoolbox ${XSD_LIBRARIES})
set_target_properties(linphone-daemon PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(linphone-daemon PROPERTIES LINKER_LANGUAGE CXX)
add_executable(linphone-daemon-pipetest ${DAEMON_PIPETEST_SOURCE_FILES})
target_link_libraries(linphone-daemon-pipetest ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES})
target_link_libraries(linphone-daemon-pipetest ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer)
set_target_properties(linphone-daemon-pipetest PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(linphone-daemon-pipetest PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -21,7 +21,7 @@
############################################################################
install(FILES rootca.pem
DESTINATION ${PACKAGE_DATA_DIR}/linphone
DESTINATION "${CMAKE_INSTALL_DATADIR}/linphone"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
......@@ -30,7 +30,7 @@ set(GRAMMAR_FILES
)
install(FILES ${GRAMMAR_FILES}
DESTINATION ${PACKAGE_GRAMMAR_DIR}
DESTINATION "${CMAKE_INSTALL_DATADIR}/belr/grammars"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
......@@ -44,7 +44,7 @@ set(SOUND_FILES
)
install(FILES ${SOUND_FILES}
DESTINATION ${PACKAGE_SOUND_DIR}
DESTINATION "${CMAKE_INSTALL_DATADIR}/linphone/sounds/linphone"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
......@@ -59,7 +59,7 @@ if(ENABLE_GTK_UI)
)
install(FILES ${FREEDESKTOP_FILES}
DESTINATION ${PACKAGE_FREEDESKTOP_DIR}
DESTINATION "${CMAKE_INSTALL_DATADIR}/applications"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
......
......@@ -32,6 +32,6 @@ set(RING_FILES
install(FILES ${RING_FILES}
DESTINATION ${PACKAGE_RING_DIR}
DESTINATION "${CMAKE_INSTALL_DATADIR}/linphone/sounds/rings"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
......@@ -20,56 +20,65 @@
#
############################################################################
set(LIBS
${BCTOOLBOX_CORE_LIBRARIES}
${BELLESIP_LIBRARIES}
${MEDIASTREAMER2_LIBRARIES}
${ORTP_LIBRARIES}
${XML2_LIBRARIES}
${BELR_LIBRARIES}
${LIBXSD_LIBRARIES}
set(LINK_LIBS
bctoolbox
bellesip
belr
mediastreamer
ortp
)
set(INTERFACE_LIBS ${LINK_LIBS} xml2 xsd)
list(APPEND LINK_LIBS ${XML2_LIBRARIES} ${LIBXSD_LIBRARIES})
if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
list(APPEND LIBS "Ws2_32")
endif()
if(LIME_FOUND)
list(APPEND LIBS ${LIME_LIBRARIES})
list(APPEND INTERFACE_LIBS lime)
list(APPEND LINK_LIBS ${LIME_LIBRARIES})
endif()
if(ENABLE_LIME)
list(APPEND LIBS ${BZRTP_LIBRARIES})
if(ENABLE_LIME OR ENABLE_LIME_X3DH)
list(APPEND INTERFACE_LIBS bzrtp)
list(APPEND LINK_LIBS ${BZRTP_LIBRARIES})
endif()
if(ZLIB_FOUND)
list(APPEND LIBS ${ZLIB_LIBRARIES})
list(APPEND INTERFACE_LIBS z)
list(APPEND LINK_LIBS ${ZLIB_LIBRARIES})
endif()
if(SOCI_FOUND)
list(APPEND LIBS ${SOCI_LIBRARIES})
list(APPEND INTERFACE_LIBS soci)
list(APPEND LINK_LIBS ${SOCI_LIBRARIES})
if(APPLE)
list(APPEND LIBS ${SOCI_sqlite3_PLUGIN})
list(APPEND INTERFACE_LIBS ${SOCI_sqlite3_PLUGIN})
list(APPEND LINK_LIBS ${SOCI_sqlite3_PLUGIN})
endif()
endif()
if(SQLITE3_FOUND)
list(APPEND LIBS ${SQLITE3_LIBRARIES})
list(APPEND INTERFACE_LIBS sqlite3)
list(APPEND LINK_LIBS ${SQLITE3_LIBRARIES})
endif()
if(ICONV_FOUND)
list(APPEND LIBS ${ICONV_LIBRARIES})
list(APPEND INTERFACE_LIBS iconv)
list(APPEND LINK_LIBS ${ICONV_LIBRARIES})
endif()
if(ENABLE_TUNNEL)
list(APPEND LIBS ${TUNNEL_LIBRARIES})
list(APPEND LINK_LIBS ${TUNNEL_LIBRARIES})
add_definitions(-DTUNNEL_ENABLED)
endif()
if(MSVC AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
list(APPEND LIBS ${LIBGCC} ${LIBMINGWEX})
list(APPEND LINK_LIBS ${LIBGCC} ${LIBMINGWEX})
endif()
if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
list(APPEND LIBS shlwapi)
list(APPEND LINK_LIBS shlwapi)
endif()
if(INTL_FOUND)
list(APPEND LIBS ${INTL_LIBRARIES})
list(APPEND INTERFACE_LIBS intl)
list(APPEND LINK_LIBS ${INTL_LIBRARIES})
endif()
if(BELCARD_FOUND)
list(APPEND LIBS ${BELCARD_LIBRARIES})
endif()
if(ENABLE_TUNNEL)
add_definitions(-DTUNNEL_ENABLED)
list(APPEND INTERFACE_LIBS belcard)
list(APPEND LINK_LIBS belcard)
endif()
#define log domain for this part of code
......@@ -392,12 +401,10 @@ if(LIME_FOUND)
endif()
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS
${BELR_INCLUDE_DIRS}
${LIBXSD_INCLUDE_DIRS}
${SOCI_INCLUDE_DIRS}
${SOCI_MYSQL_INCLUDES}
)
set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS})
set(LINPHONE_PRIVATE_HEADER_FILES)
foreach (header ${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES})
......@@ -411,15 +418,20 @@ endif()
bc_apply_compile_flags(LINPHONE_CXX_OBJECTS_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
bc_apply_compile_flags(LINPHONE_OBJC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
if(ENABLE_STATIC)
add_library(linphone-static STATIC ${LINPHONE_HEADER_FILES}
${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} ${LINPHONE_OBJC_SOURCE_FILES}
$<TARGET_OBJECTS:linphone-coreapi-static>
)
set_target_properties(linphone-static PROPERTIES OUTPUT_NAME linphone)
target_include_directories(linphone-static PUBLIC ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(linphone-static INTERFACE ${LIBS})
target_include_directories(linphone-static PUBLIC
$<INSTALL_INTERFACE:include/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/coreapi/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/>
PRIVATE ${LINPHONE_INCLUDE_DIRS}
)
target_link_libraries(linphone-static PRIVATE ${LINK_LIBS})
if(APPLE)
target_link_libraries(linphone-static INTERFACE "-framework Foundation" "-framework AVFoundation" "-framework SystemConfiguration")
endif()
......@@ -458,8 +470,14 @@ if(ENABLE_SHARED)
# Do not version shared library on Android
set_target_properties(linphone PROPERTIES SOVERSION ${LINPHONE_SO_VERSION})
endif()
target_include_directories(linphone PUBLIC ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(linphone PRIVATE ${LIBS})
target_include_directories(linphone PUBLIC
$<INSTALL_INTERFACE:include/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/coreapi/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/>
PRIVATE ${LINPHONE_INCLUDE_DIRS}
)
target_link_libraries(linphone PRIVATE ${LINK_LIBS})
if(APPLE)
target_link_libraries(linphone PRIVATE "-framework Foundation" "-framework AVFoundation" "-framework SystemConfiguration")
endif()
......
......@@ -20,7 +20,8 @@
#
############################################################################
set(OTHER_LIBS_FOR_TESTER ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES} ${XML2_LIBRARIES} ${XSD_LIBRARIES} ${BELR_LIBRARIES})
set(OTHER_LIBS_FOR_TESTER bctoolbox bctoolbox-tester ortp mediastreamer bellesip belr ${XML2_LIBRARIES} ${XSD_LIBRARIES})
if(INTL_FOUND)
list(APPEND OTHER_LIBS_FOR_TESTER ${INTL_LIBRARIES})
endif()
......@@ -293,7 +294,7 @@ endif()
# on mobile platforms, we compile the tester as a library so that we can link with it directly from native applications
if(ANDROID OR IOS)
add_library(linphonetester SHARED ${HEADER_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_CXX})
target_include_directories(linphonetester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_include_directories(linphonetester PRIVATE ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(linphonetester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
#TODO: replace by if(APPLE) when we want to make apple framework on linphone-desktop too
if(IOS)
......@@ -322,7 +323,7 @@ if(ANDROID OR IOS)
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
add_library(linphone_tester_static STATIC ${HEADER_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_CXX})
target_include_directories(linphone_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_include_directories(linphone_tester_static PRIVATE ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(linphone_tester_static ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
set(RUNTIME_COMPONENT_SOURCES
......@@ -357,7 +358,7 @@ if(NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set_target_properties(liblinphone_tester PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(liblinphone_tester PROPERTIES C_STANDARD 99)
target_include_directories(liblinphone_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_include_directories(liblinphone_tester PRIVATE ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
install(TARGETS liblinphone_tester
......@@ -371,7 +372,7 @@ if(NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set_target_properties(groupchat_benchmark PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(groupchat_benchmark PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(groupchat_benchmark PROPERTIES C_STANDARD 99)
target_include_directories(groupchat_benchmark PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_include_directories(groupchat_benchmark PRIVATE ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(groupchat_benchmark ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
install(TARGETS groupchat_benchmark
......
......@@ -33,35 +33,35 @@ endif()
set(LP_AUTO_ANSWER_SOURCE_FILES auto_answer.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} ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES} ${XSD_LIBRARIES})
target_link_libraries(lp-auto-answer ${LINPHONE_LIBS_FOR_TOOLS} mediastreamer ortp bctoolbox ${XSD_LIBRARIES})
set_target_properties(lp-auto-answer PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(lp-auto-answer PROPERTIES LINKER_LANGUAGE CXX)
set(LP_SENDMSG_SOURCE_FILES lpsendmsg.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} ${XSD_LIBRARIES})
target_link_libraries(lp-sendmsg ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer ${XSD_LIBRARIES})
set_target_properties(lp-sendmsg PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(lp-sendmsg PROPERTIES LINKER_LANGUAGE CXX)
set(LP_LPC2XML_TEST_SOURCE_FILES lpc2xml_test.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} ${XSD_LIBRARIES})
target_link_libraries(lpc2xml_test ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer ${XSD_LIBRARIES})
set_target_properties(lpc2xml_test PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(lpc2xml_test PROPERTIES LINKER_LANGUAGE CXX)
set(LP_XML2LPC_TEST_SOURCE_FILES xml2lpc_test.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} ${XSD_LIBRARIES})
target_link_libraries(xml2lpc_test ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer ${XSD_LIBRARIES})
set_target_properties(xml2lpc_test PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(xml2lpc_test PROPERTIES LINKER_LANGUAGE CXX)
set(LP_TEST_ECC_SOURCE_FILES test_ecc.c)
bc_apply_compile_flags(LP_TEST_ECC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_executable(lp-test-ecc ${USE_BUNDLE} ${LP_TEST_ECC_SOURCE_FILES})
target_link_libraries(lp-test-ecc ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES} ${XSD_LIBRARIES})
target_link_libraries(lp-test-ecc ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer bctoolbox ${XSD_LIBRARIES})
set_target_properties(lp-test-ecc PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(lp-test-ecc PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -76,6 +76,9 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/linphone++
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
set(TARGET_NAME "LinphoneCxx")
set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/${TARGET_NAME}")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxVersion.cmake"
......@@ -85,7 +88,11 @@ write_basic_package_version_file(
export(EXPORT LinphoneCxxTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxTargets.cmake"
)
configure_file(LinphoneCxxConfig.cmake.in LinphoneCxxConfig.cmake @ONLY)
configure_package_config_file(LinphoneCxxConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxConfig.cmake"
INSTALL_DESTINATION ${CONFIG_PACKAGE_LOCATION}
NO_SET_AND_CHECK_MACRO
)
install(EXPORT LinphoneCxxTargets
FILE LinphoneCxxTargets.cmake
......