Commit 265dcd05 authored by Ghislain MARY's avatar Ghislain MARY

Add new CMake macro to ease the writing of CMake package config-file.

parent e93227f5
......@@ -35,3 +35,18 @@ macro(bc_apply_compile_flags SOURCE_FILES)
endif()
endif()
endmacro()
macro(bc_set_libraries_from_static_target LIBRARIES TARGET_NAME)
if(TARGET ${TARGET_NAME})
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(${LIBRARIES} ${TARGET_NAME})
else()
get_target_property(${LIBRARIES} ${TARGET_NAME} LOCATION)
endif()
get_target_property(_link_libraries ${TARGET_NAME} INTERFACE_LINK_LIBRARIES)
if(_link_libraries)
list(APPEND ${LIBRARIES} ${_link_libraries})
endif()
endif()
endmacro()
......@@ -34,6 +34,8 @@
# BCTOOLBOX_${comp}_INCLUDE_DIRS - the bctoolbox "comp" component include directory
# BCTOOLBOX_${comp}_LIBRARIES - The libraries needed to use bctoolbox "comp" component
include("${CMAKE_CURRENT_LIST_DIR}/BcToolboxCMakeUtils.cmake")
if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${CMAKE_CURRENT_LIST_DIR}/BcToolboxTargets.cmake")
endif()
......@@ -56,13 +58,7 @@ foreach(comp ${BcToolbox_FIND_COMPONENTS})
set(BCTOOLBOX_${uppercomp}_LIBRARIES ${targetname})
else()
set(targetname ${targetname}-static)
if(TARGET ${targetname})
get_target_property(BCTOOLBOX_${uppercomp}_LIBRARIES ${targetname} LOCATION)
get_target_property(BCTOOLBOX_${uppercomp}_LINK_LIBRARIES ${targetname} INTERFACE_LINK_LIBRARIES)
if(BCTOOLBOX_${uppercomp}_LINK_LIBRARIES)
list(APPEND BCTOOLBOX_${uppercomp}_LIBRARIES ${BCTOOLBOX_${uppercomp}_LINK_LIBRARIES})
endif()
endif()
bc_set_libraries_from_static_target(BCTOOLBOX_${uppercomp}_LIBRARIES ${targetname})
endif()
if(TARGET ${targetname})
get_target_property(BCTOOLBOX_${uppercomp}_INCLUDE_DIRS ${targetname} INTERFACE_INCLUDE_DIRECTORIES)
......@@ -86,4 +82,3 @@ if(BCTOOLBOX_INCLUDE_DIRS)
list(REMOVE_DUPLICATES BCTOOLBOX_INCLUDE_DIRS)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/BcToolboxCMakeUtils.cmake")
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