BcToolboxConfig.cmake.in 3.66 KB
Newer Older
jehan's avatar
jehan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
############################################################################
# BcToolboxConfig.cmake
# Copyright (C) 2015  Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
jehan's avatar
jehan committed
20 21 22
#
############################################################################
#
23 24 25
# Config file for the bctoolbox package.
# Some components can be asked for: core, tester.
#
jehan's avatar
jehan committed
26 27 28 29 30
# It defines the following variables:
#
#  BCTOOLBOX_FOUND - system has bctoolbox
#  BCTOOLBOX_INCLUDE_DIRS - the bctoolbox include directory
#  BCTOOLBOX_LIBRARIES - The libraries needed to use bctoolbox
31
#  BCTOOLBOX_CPPFLAGS - The compilation flags needed to use bctoolbox
jehan's avatar
jehan committed
32
#  BCTOOLBOX_LDFLAGS - The linking flags needed to use bctoolbox
33 34 35
#  BCTOOLBOX_${comp}_FOUND - system has bctoolbox "comp" component
#  BCTOOLBOX_${comp}_INCLUDE_DIRS - the bctoolbox "comp" component include directory
#  BCTOOLBOX_${comp}_LIBRARIES - The libraries needed to use bctoolbox "comp" component
jehan's avatar
jehan committed
36 37 38 39 40

if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
	include("${CMAKE_CURRENT_LIST_DIR}/BcToolboxTargets.cmake")
endif()

41 42 43 44
list(APPEND BcToolbox_FIND_COMPONENTS core)
list(REMOVE_DUPLICATES BcToolbox_FIND_COMPONENTS)
set(BcToolbox_FIND_REQUIRED_core TRUE)

45
set(BCTOOLBOX_CPPFLAGS @BCTOOLBOX_CPPFLAGS@)
jehan's avatar
jehan committed
46
set(BCTOOLBOX_LDFLAGS "@LINK_FLAGS_STR@")
47 48 49 50
set(BCTOOLBOX_LIBRARIES )
foreach(comp ${BcToolbox_FIND_COMPONENTS})
	string(TOUPPER ${comp} uppercomp)
	if(comp STREQUAL "core")
51
		set(targetname bctoolbox)
52
	else()
53
		set(targetname bctoolbox-${comp})
54
	endif()
55 56 57 58 59 60 61 62 63 64 65
	if(@ENABLE_SHARED@)
		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()
66 67
	endif()
	if(TARGET ${targetname})
68 69 70 71 72 73 74 75 76
		get_target_property(BCTOOLBOX_${uppercomp}_INCLUDE_DIRS ${targetname} INTERFACE_INCLUDE_DIRECTORIES)
		if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
			list(INSERT BCTOOLBOX_${uppercomp}_INCLUDE_DIRS 0 "${EP_bctoolbox_INCLUDE_DIR}")
		else()
			list(INSERT BCTOOLBOX_${uppercomp}_INCLUDE_DIRS 0 "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
		endif()
		list(REMOVE_DUPLICATES BCTOOLBOX_${uppercomp}_INCLUDE_DIRS)
		list(APPEND BCTOOLBOX_LIBRARIES ${BCTOOLBOX_${uppercomp}_LIBRARIES})
		list(APPEND BCTOOLBOX_INCLUDE_DIRS ${BCTOOLBOX_${uppercomp}_INCLUDE_DIRS})
77 78 79 80 81 82 83 84
		set(BCTOOLBOX_${uppercomp}_FOUND 1)
		if(comp STREQUAL "core")
			set(BCTOOLBOX_FOUND 1)
		endif()
	elseif(BcToolbox_FIND_REQUIRED_${comp})
		message(FATAL_ERROR "Required bctoolbox component \"${comp}\" cannot be found")
	endif()
endforeach()
85 86 87
if(BCTOOLBOX_INCLUDE_DIRS)
	list(REMOVE_DUPLICATES BCTOOLBOX_INCLUDE_DIRS)
endif()
88 89

include("${CMAKE_CURRENT_LIST_DIR}/BcToolboxCMakeUtils.cmake")