Commit 6fcadc1a authored by Ghislain MARY's avatar Ghislain MARY

Improve CMake config-file package.

parent 11585779
......@@ -60,7 +60,6 @@ endif()
include_directories(
include/
src/
${BCTOOLBOX_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
if(MSVC)
......
......@@ -32,18 +32,24 @@ if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${CMAKE_CURRENT_LIST_DIR}/BelrTargets.cmake")
endif()
get_filename_component(BELR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(BELR_INCLUDE_DIRS "${EP_belr_INCLUDE_DIR}")
if(@ENABLE_SHARED@)
set(BELR_TARGETNAME belr)
set(BELR_LIBRARIES ${BELR_TARGETNAME})
else()
set(BELR_INCLUDE_DIRS "${BELR_CMAKE_DIR}/../../../include")
set(BELR_TARGETNAME belr-static)
get_target_property(BELR_LIBRARIES ${BELR_TARGETNAME} LOCATION)
get_target_property(BELR_LINK_LIBRARIES ${BELR_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(BELR_LINK_LIBRARIES)
list(APPEND BELR_LIBRARIES ${BELR_LINK_LIBRARIES})
endif()
endif()
if(@ENABLE_SHARED@)
set(BELR_LIBRARIES belr)
get_target_property(BELR_INCLUDE_DIRS ${BELR_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
list(INSERT BELR_INCLUDE_DIRS 0 "${EP_belr_INCLUDE_DIR}")
else()
set(BELR_LIBRARIES belr-static)
list(INSERT BELR_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
endif()
list(REMOVE_DUPLICATES BELR_INCLUDE_DIRS)
set(BELR_CPPFLAGS @BELR_CPPFLAGS@)
set(BELR_FOUND 1)
......@@ -35,7 +35,8 @@ bc_apply_compile_flags(BELR_SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_C
if(ENABLE_STATIC)
add_library(belr-static STATIC ${BELR_HEADER_FILES} ${BELR_SOURCE_FILES_C} ${BELR_SOURCE_FILES_CXX})
set_target_properties(belr-static PROPERTIES OUTPUT_NAME belr)
target_link_libraries(belr-static ${BCTOOLBOX_CORE_LIBRARIES})
target_include_directories(belr-static PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS})
target_link_libraries(belr-static INTERFACE ${BCTOOLBOX_CORE_LIBRARIES})
endif()
if(ENABLE_SHARED)
add_library(belr SHARED ${BELR_HEADER_FILES} ${BELR_SOURCE_FILES_C} ${BELR_SOURCE_FILES_CXX})
......@@ -43,6 +44,7 @@ if(ENABLE_SHARED)
set_target_properties(belr PROPERTIES LINK_FLAGS "-stdlib=libc++")
endif()
set_target_properties(belr PROPERTIES VERSION ${BELR_SO_VERSION})
target_include_directories(belr PUBLIC ${BCTOOLBOX_CORE_INCLUDE_DIRS})
target_link_libraries(belr PRIVATE ${BCTOOLBOX_CORE_LIBRARIES})
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