[Pkg-voip-commits] [bctoolbox] 27/60: Add new CMake macro to ease the writing of CMake package config-file.

Bernhard Schmidt berni at moszumanska.debian.org
Sun Oct 15 22:42:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

berni pushed a commit to branch debian/sid
in repository bctoolbox.

commit 265dcd05c20baa950053c420bd467067131a1968
Author: Ghislain MARY <ghislain.mary at belledonne-communications.com>
Date:   Fri Apr 21 11:19:18 2017 +0200

    Add new CMake macro to ease the writing of CMake package config-file.
---
 cmake/BcToolboxCMakeUtils.cmake | 15 +++++++++++++++
 cmake/BcToolboxConfig.cmake.in  | 11 +++--------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/cmake/BcToolboxCMakeUtils.cmake b/cmake/BcToolboxCMakeUtils.cmake
index 63be661..1223280 100644
--- a/cmake/BcToolboxCMakeUtils.cmake
+++ b/cmake/BcToolboxCMakeUtils.cmake
@@ -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()
+
diff --git a/cmake/BcToolboxConfig.cmake.in b/cmake/BcToolboxConfig.cmake.in
index 0b9a12f..29526dd 100644
--- a/cmake/BcToolboxConfig.cmake.in
+++ b/cmake/BcToolboxConfig.cmake.in
@@ -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")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/bctoolbox.git



More information about the Pkg-voip-commits mailing list