Commit 13bbfe95 authored by Ghislain MARY's avatar Ghislain MARY

Improve CMake config-file package.

parent 37542fae
......@@ -91,7 +91,6 @@ endif()
include_directories(
include
${CMAKE_CURRENT_BINARY_DIR}
${BCTOOLBOX_CORE_INCLUDE_DIRS}
)
set(LIBS ${BCTOOLBOX_CORE_LIBRARIES})
......
......@@ -32,24 +32,24 @@ if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${CMAKE_CURRENT_LIST_DIR}/BZRTPTargets.cmake")
endif()
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake")
if(@ENABLE_SHARED@)
set(BZRTP_TARGETNAME bzrtp)
set(BZRTP_LIBRARIES ${BZRTP_TARGETNAME})
else()
find_package(BcToolbox 0.0.3 REQUIRED COMPONENTS core)
set(BZRTP_TARGETNAME bzrtp-static)
get_target_property(BZRTP_LIBRARIES ${BZRTP_TARGETNAME} LOCATION)
get_target_property(BZRTP_LINK_LIBRARIES ${BZRTP_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(BZRTP_LINK_LIBRARIES)
list(APPEND BZRTP_LIBRARIES ${BZRTP_LIBRARIES})
endif()
endif()
get_filename_component(BZRTP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_target_property(BZRTP_INCLUDE_DIRS ${BZRTP_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(BZRTP_INCLUDE_DIRS "${EP_bzrtp_INCLUDE_DIR}")
list(INSERT BZRTP_INCLUDE_DIRS 0 "${EP_bzrtp_INCLUDE_DIR}")
else()
set(BZRTP_INCLUDE_DIRS "${BZRTP_CMAKE_DIR}/../../../include")
endif()
list(APPEND BZRTP_INCLUDE_DIRS ${BCTOOLBOX_CORE_INCLUDE_DIRS})
list(APPEND BZRTP_LIBRARIES ${BCTOOLBOX_CORE_LIBRARIES})
if(@ENABLE_SHARED@)
set(BZRTP_LIBRARIES bzrtp)
else()
set(BZRTP_LIBRARIES bzrtp-static)
list(INSERT BZRTP_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
endif()
list(REMOVE_DUPLICATES BZRTP_INCLUDE_DIRS)
set(BZRTP_CPPFLAGS @BZRTP_CPPFLAGS@)
set(BZRTP_FOUND 1)
......@@ -39,7 +39,8 @@ bc_apply_compile_flags(SOURCE_FILES STRICT_OPTIONS_CPP)
if(ENABLE_STATIC)
add_library(bzrtp-static STATIC ${SOURCE_FILES})
set_target_properties(bzrtp-static PROPERTIES OUTPUT_NAME bzrtp)
target_link_libraries(bzrtp-static ${LIBS})
target_include_directories(bzrtp-static PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS})
target_link_libraries(bzrtp-static INTERFACE ${LIBS})
install(TARGETS bzrtp-static EXPORT ${EXPORT_TARGETS_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
......@@ -49,6 +50,7 @@ if(ENABLE_SHARED)
add_library(bzrtp SHARED ${SOURCE_FILES})
target_compile_definitions(bzrtp PRIVATE "-DZRTP_EXPORTS")
set_target_properties(bzrtp PROPERTIES VERSION 0)
target_include_directories(bzrtp PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS})
target_link_libraries(bzrtp PRIVATE ${LIBS})
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
......
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