BcToolboxConfig.cmake.in 3 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)

jehan's avatar
jehan committed
45 46 47 48 49 50
get_filename_component(BCTOOLBOX_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
	set(BCTOOLBOX_INCLUDE_DIRS "${EP_bctoolbox_INCLUDE_DIR}")
else()
	set(BCTOOLBOX_INCLUDE_DIRS "${BCTOOLBOX_CMAKE_DIR}/../../../include")
endif()
51

52
set(BCTOOLBOX_CPPFLAGS @BCTOOLBOX_CPPFLAGS@)
jehan's avatar
jehan committed
53
set(BCTOOLBOX_LDFLAGS "@LINK_FLAGS_STR@")
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
set(BCTOOLBOX_LIBRARIES )
foreach(comp ${BcToolbox_FIND_COMPONENTS})
	string(TOUPPER ${comp} uppercomp)
	if(comp STREQUAL "core")
		set(targetname "bctoolbox")
	else()
		set(targetname "bctoolbox-${comp}")
	endif()
	if(NOT @ENABLE_SHARED@)
		set(targetname "${targetname}-static")
	endif()
	if(TARGET ${targetname})
		set(BCTOOLBOX_${uppercomp}_INCLUDE_DIRS "${BCTOOLBOX_INCLUDE_DIRS}")
		set(BCTOOLBOX_${uppercomp}_LIBRARIES ${targetname})
		list(APPEND BCTOOLBOX_LIBRARIES ${targetname})
		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()