Commit 713e5f3c authored by Ghislain MARY's avatar Ghislain MARY

Improve CMake config-file package.

parent 961caa4a
......@@ -33,36 +33,25 @@ if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${CMAKE_CURRENT_LIST_DIR}/BelleSIPTargets.cmake")
endif()
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake")
if(@ENABLE_SHARED@)
set(BELLESIP_TARGETNAME bellesip)
set(BELLESIP_LIBRARIES ${BELLESIP_TARGETNAME})
else()
find_package(BcToolbox 0.0.3 REQUIRED COMPONENTS core)
endif()
if(@ENABLE_TUNNEL@)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_tunnel_CONFIG_DIR}/TunnelConfig.cmake")
else()
find_package(Tunnel)
set(BELLESIP_TARGETNAME bellesip-static)
get_target_property(BELLESIP_LIBRARIES ${BELLESIP_TARGETNAME} LOCATION)
get_target_property(BELLESIP_LINK_LIBRARIES ${BELLESIP_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(BELLESIP_LINK_LIBRARIES)
list(APPEND BELLESIP_LIBRARIES ${BELLESIP_LINK_LIBRARIES})
endif()
endif()
get_filename_component(BELLESIP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_target_property(BELLESIP_INCLUDE_DIRS ${BELLESIP_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(BELLESIP_INCLUDE_DIRS "${EP_bellesip_INCLUDE_DIR}")
list(INSERT BELLESIP_INCLUDE_DIRS 0 "${EP_bellesip_INCLUDE_DIR}")
else()
set(BELLESIP_INCLUDE_DIRS "${BELLESIP_CMAKE_DIR}/../../../include")
list(INSERT BELLESIP_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
endif()
if(@ENABLE_SHARED@)
set(BELLESIP_LIBRARIES bellesip)
else()
set(BELLESIP_LIBRARIES bellesip-static)
endif()
list(APPEND BELLESIP_INCLUDE_DIRS ${BCTOOLBOX_CORE_INCLUDE_DIRS})
list(APPEND BELLESIP_LIBRARIES ${BCTOOLBOX_CORE_LIBRARIES})
list(REMOVE_DUPLICATES BELLESIP_INCLUDE_DIRS)
set(BELLESIP_CPPFLAGS @BELLESIP_CPPFLAGS@)
set(BELLESIP_LDFLAGS "@LINK_FLAGS_STR@")
if(TUNNEL_FOUND)
list(APPEND BELLESIP_INCLUDE_DIRS ${TUNNEL_INCLUDE_DIRS})
list(APPEND BELLESIP_LIBRARIES ${TUNNEL_LIBRARIES})
endif()
set(BELLESIP_FOUND 1)
......@@ -196,7 +196,7 @@ if(ENABLE_STATIC)
add_library(bellesip-static STATIC ${BELLE_SIP_HEADER_FILES} ${BELLE_SIP_SOURCE_FILES_C} ${BELLE_SIP_SOURCE_FILES_CXX} ${BELLE_SIP_SOURCE_FILES_OBJC})
set_target_properties(bellesip-static PROPERTIES OUTPUT_NAME bellesip)
target_include_directories(bellesip-static PUBLIC ${INCLUDES})
target_link_libraries(bellesip-static ${LIBS})
target_link_libraries(bellesip-static INTERFACE ${LIBS})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(bellesip-static PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif()
......
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