From 16fa9f86937718003affc671103376049acf994a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 6 Aug 2014 18:11:31 +0200 Subject: [PATCH] Add CMake script to find linphone library. --- CMakeLists.txt | 6 ++++ FindLinphone.cmake | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 FindLinphone.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 94f49e8f0..7440ba633 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,3 +90,9 @@ add_definitions(-DHAVE_CONFIG_H) add_subdirectory(coreapi) add_subdirectory(share) + + +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/FindLinphone.cmake + DESTINATION share/cmake/Modules + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ +) diff --git a/FindLinphone.cmake b/FindLinphone.cmake new file mode 100644 index 000000000..fdb582c72 --- /dev/null +++ b/FindLinphone.cmake @@ -0,0 +1,69 @@ +############################################################################ +# FindLinphone.txt +# Copyright (C) 2014 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 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ +# +# - Find the linphone include file and library +# +# LINPHONE_FOUND - system has linphone +# LINPHONE_INCLUDE_DIRS - the linphone include directory +# LINPHONE_LIBRARIES - The libraries needed to use linphone +# LINPHONE_CPPFLAGS - The compilation flags needed to use linphone + +find_package(ORTP REQUIRED) +find_package(MS2 REQUIRED) +find_package(XML2 REQUIRED) +find_package(BelleSIP REQUIRED) + +set(_LINPHONEROOT_PATHS + ${WITH_LINPHONE} + ${CMAKE_INSTALL_PREFIX} +) + +find_path(LINPHONE_INCLUDE_DIRS + NAMES linphone/linphonecore.h + HINTS _LINPHONE_ROOT_PATHS + PATH_SUFFIXES include +) + +if(LINPHONE_INCLUDE_DIRS) + set(HAVE_LINPHONE_LINPHONECORE_H 1) +endif() + +find_library(LINPHONE_LIBRARIES + NAMES linphone + HINTS ${_LINPHONE_ROOT_PATHS} + PATH_SUFFIXES bin lib +) + +list(APPEND LINPHONE_INCLUDE_DIRS ${ORTP_INCLUDE_DIRS} ${MS2_INCLUDE_DIRS} ${XML2_INCLUDE_DIRS} ${BELLESIP_INCLUDE_DIRS}) +list(APPEND LINPHONE_LIBRARIES ${ORTP_LIBRARIES} ${MS2_LIBRARIES} ${XML2_LIBRARIES} ${BELLESIP_LIBRARIES}) + +list(REMOVE_DUPLICATES LINPHONE_INCLUDE_DIRS) +list(REMOVE_DUPLICATES LINPHONE_LIBRARIES) +set(LINPHONE_CPPFLAGS ${MS2_CPPFLAGS}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Linphone + DEFAULT_MSG + LINPHONE_INCLUDE_DIRS LINPHONE_LIBRARIES LINPHONE_CPPFLAGS +) + +mark_as_advanced(LINPHONE_INCLUDE_DIRS LINPHONE_LIBRARIES LINPHONE_CPPFLAGS)