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