Commit ea503736 authored by Ghislain MARY's avatar Ghislain MARY

Improve CMake config-file package.

parent 142ff74f
......@@ -111,11 +111,13 @@ 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")
else()
find_package(BelleSIP REQUIRED)
find_package(Mediastreamer2 REQUIRED)
find_package(ORTP REQUIRED)
find_package(BcToolbox 0.0.3 REQUIRED OPTIONAL_COMPONENTS tester)
endif()
find_package(XML2 REQUIRED)
......@@ -194,6 +196,8 @@ include_directories(
coreapi/
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/coreapi/
)
set(LINPHONE_INCLUDE_DIRS
${BELLESIP_INCLUDE_DIRS}
${MEDIASTREAMER2_INCLUDE_DIRS}
${BCTOOLBOX_CORE_INCLUDE_DIRS}
......@@ -202,27 +206,27 @@ if(ANDROID)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/java)
endif()
if(ENABLE_TUNNEL)
include_directories(${TUNNEL_INCLUDE_DIRS})
list(APPEND LINPHONE_INCLUDE_DIRS ${TUNNEL_INCLUDE_DIRS})
endif()
if (ENABLE_VCARD)
include_directories(${BELCARD_INCLUDE_DIRS})
list(APPEND LINPHONE_INCLUDE_DIRS ${BELCARD_INCLUDE_DIRS})
endif()
include_directories(${XML2_INCLUDE_DIRS})
list(APPEND LINPHONE_INCLUDE_DIRS ${XML2_INCLUDE_DIRS})
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
list(APPEND LINPHONE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
set(HAVE_ZLIB 1)
endif()
if(SQLITE3_FOUND)
include_directories(${SQLITE3_INCLUDE_DIRS})
list(APPEND LINPHONE_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIRS})
if(ENABLE_SQLITE_STORAGE)
add_definitions("-DSQLITE_STORAGE_ENABLED")
endif()
endif()
if(INTL_FOUND)
set(HAVE_INTL 1)
include_directories(${INTL_INCLUDE_DIRS})
list(APPEND LINPHONE_INCLUDE_DIRS ${INTL_INCLUDE_DIRS})
endif()
if(MSVC)
include_directories(${MSVC_INCLUDE_DIR})
......
......@@ -33,40 +33,25 @@ if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${CMAKE_CURRENT_LIST_DIR}/LinphoneTargets.cmake")
endif()
find_package(Mediastreamer2 REQUIRED)
find_package(BelleSIP REQUIRED)
if(@ENABLE_TUNNEL@)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_tunnel_CONFIG_DIR}/TunnelConfig.cmake")
else()
find_package(Tunnel)
endif()
endif()
if(@ENABLE_VCARD@)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_belcard_CONFIG_DIR}/BelcardConfig.cmake")
else()
find_package(Belcard)
if(@ENABLE_SHARED@)
set(LINPHONE_TARGETNAME linphone)
set(LINPHONE_LIBRARIES ${LINPHONE_TARGETNAME})
else()
set(LINPHONE_TARGETNAME linphone-static)
get_target_property(LINPHONE_LIBRARIES ${LINPHONE_TARGETNAME} LOCATION)
get_target_property(LINPHONE_LINK_LIBRARIES ${LINPHONE_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(LINPHONE_LINK_LIBRARIES)
list(APPEND LINPHONE_LIBRARIES ${LINPHONE_LINK_LIBRARIES})
endif()
endif()
get_filename_component(LINPHONE_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(LINPHONE_INCLUDE_DIRS "${LINPHONE_CMAKE_DIR}/../../../include")
if(@ENABLE_SHARED@)
set(LINPHONE_LIBRARIES linphone)
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()
set(LINPHONE_LIBRARIES linphone-static)
list(INSERT LINPHONE_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
endif()
list(APPEND LINPHONE_INCLUDE_DIRS ${MEDIASTREAMER2_INCLUDE_DIRS} ${BELLESIP_INCLUDE_DIRS})
list(APPEND LINPHONE_LIBRARIES ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES})
list(REMOVE_DUPLICATES LINPHONE_INCLUDE_DIRS)
set(LINPHONE_CPPFLAGS @LINPHONE_CPPFLAGS@)
set(LINPHONE_LDFLAGS "${MEDIASTREAMER2_LDFLAGS} ${BELLESIP_LDFLAGS}")
if(TUNNEL_FOUND)
list(APPEND LINPHONE_INCLUDE_DIRS ${TUNNEL_INCLUDE_DIRS})
list(APPEND LINPHONE_LIBRARIES ${TUNNEL_LIBRARIES})
endif()
if(BELCARD_FOUND)
list(APPEND LINPHONE_INCLUDE_DIRS ${BELCARD_INCLUDE_DIRS})
list(APPEND LINPHONE_LIBRARIES ${BELCARD_LIBRARIES})
endif()
set(LINPHONE_LDFLAGS "@LINPHONE_LDFLAGS@")
set(LINPHONE_FOUND 1)
......@@ -155,7 +155,7 @@ set(LIBS
${MEDIASTREAMER2_LIBRARIES}
${XML2_LIBRARIES}
)
if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WinddowsStore")
if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
list(APPEND LIBS "Ws2_32")
endif()
if(ZLIB_FOUND)
......@@ -200,12 +200,13 @@ 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})
set_target_properties(linphone-static PROPERTIES OUTPUT_NAME linphone)
add_dependencies(linphone-static liblinphone-git-version)
target_link_libraries(linphone-static ${LIBS})
target_include_directories(linphone-static PUBLIC ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(linphone-static INTERFACE ${LIBS})
if(ANDROID)
add_dependencies(linphone-static linphonecore-jni-header)
endif()
if(IOS)
target_link_libraries(linphone-static "-framework Foundation" "-framework AVFoundation")
target_link_libraries(linphone-static INTERFACE "-framework Foundation" "-framework AVFoundation")
endif()
install(TARGETS linphone-static EXPORT ${EXPORT_TARGETS_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
......@@ -227,6 +228,7 @@ if(ENABLE_SHARED)
set_target_properties(linphone PROPERTIES SOVERSION ${LINPHONE_SO_VERSION})
endif()
add_dependencies(linphone liblinphone-git-version)
target_include_directories(linphone PUBLIC ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(linphone PRIVATE ${LIBS})
if(WIN32 AND CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set_target_properties(linphone PROPERTIES PREFIX "lib")
......
......@@ -115,7 +115,7 @@ bc_apply_compile_flags(DAEMON_PIPETEST_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OP
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})
target_link_libraries(linphone-daemon ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES})
set_target_properties(linphone-daemon PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
add_executable(linphone-daemon-pipetest ${DAEMON_PIPETEST_SOURCE_FILES})
......
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