Commit 92081791 authored by Ghislain MARY's avatar Ghislain MARY

Improve CMake config-file package.

parent 88ef98a6
......@@ -86,7 +86,6 @@ include_directories(
include/
src/
${CMAKE_CURRENT_BINARY_DIR}
${BCTOOLBOX_CORE_INCLUDE_DIRS}
)
if(MSVC)
include_directories(${MSVC_INCLUDE_DIR})
......
......@@ -32,16 +32,24 @@ if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${CMAKE_CURRENT_LIST_DIR}/ORTPTargets.cmake")
endif()
get_filename_component(ORTP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(ORTP_INCLUDE_DIRS "${EP_ortp_INCLUDE_DIR}")
if(@ENABLE_SHARED@)
set(ORTP_TARGETNAME ortp)
set(ORTP_LIBRARIES ${ORTP_TARGETNAME})
else()
set(ORTP_INCLUDE_DIRS "${ORTP_CMAKE_DIR}/../../../include")
set(ORTP_TARGETNAME ortp-static)
get_target_property(ORTP_LIBRARIES ${ORTP_TARGETNAME} LOCATION)
get_target_property(ORTP_LINK_LIBRARIES ${ORTP_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(ORTP_LINK_LIBRARIES)
list(APPEND ORTP_LIBRARIES ${ORTP_LINK_LIBRARIES})
endif()
endif()
if(@ENABLE_SHARED@)
set(ORTP_LIBRARIES ortp)
get_target_property(ORTP_INCLUDE_DIRS ${ORTP_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
list(INSERT ORTP_INCLUDE_DIRS 0 "${EP_ortp_INCLUDE_DIR}")
else()
set(ORTP_LIBRARIES ortp-static)
list(INSERT ORTP_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
endif()
list(REMOVE_DUPLICATES ORTP_INCLUDE_DIRS)
set(ORTP_CPPFLAGS @ORTP_CPPFLAGS@)
set(ORTP_FOUND 1)
......@@ -88,7 +88,8 @@ if(ENABLE_STATIC)
add_library(ortp-static STATIC ${ORTP_HEADER_FILES} ${ORTP_SOURCE_FILES_C} ${ORTP_SOURCE_FILES_CXX})
set_target_properties(ortp-static PROPERTIES OUTPUT_NAME ortp)
target_compile_definitions(ortp-static PRIVATE "ORTP_EXPORTS")
target_link_libraries(ortp-static ${LIBS})
target_include_directories(ortp-static PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS})
target_link_libraries(ortp-static INTERFACE ${LIBS})
install(TARGETS ortp-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
......@@ -106,6 +107,7 @@ if(ENABLE_SHARED)
target_compile_options(ortp PRIVATE "/DELAYLOAD:Qwave.dll")
endif()
target_compile_definitions(ortp PRIVATE "ORTP_EXPORTS")
target_include_directories(ortp PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS})
target_link_libraries(ortp 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