From c3b4624857215e1a2e9ff1fc313b36cbfd170453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Thu, 26 Jan 2017 16:45:56 +0100 Subject: [PATCH] Generate and install LinphoneCxxConfig.cmake, LinphoneCxxTargets.cmake and LinphoneCxxVersion.cmake --- wrappers/cpp/CMakeLists.txt | 1 + wrappers/cpp/LinphoneCxxConfig.cmake.in | 39 +++++++++++++++++++++++++ wrappers/cpp/c_make_lists.mustache.in | 18 +++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 wrappers/cpp/LinphoneCxxConfig.cmake.in diff --git a/wrappers/cpp/CMakeLists.txt b/wrappers/cpp/CMakeLists.txt index f803f15c4..ad394876b 100644 --- a/wrappers/cpp/CMakeLists.txt +++ b/wrappers/cpp/CMakeLists.txt @@ -1,6 +1,7 @@ configure_file(c_make_lists.mustache.in c_make_lists.mustache @ONLY) configure_file(object.cc src/object.cc COPYONLY) configure_file(object.hh include/object.hh COPYONLY) +configure_file(LinphoneCxxConfig.cmake.in LinphoneCxxConfig.cmake @ONLY) add_custom_command(OUTPUT CMakeLists.txt include/linphone.hh COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/genwrapper.py" "${PROJECT_BINARY_DIR}/coreapi/help/doc/xml" diff --git a/wrappers/cpp/LinphoneCxxConfig.cmake.in b/wrappers/cpp/LinphoneCxxConfig.cmake.in new file mode 100644 index 000000000..b63749207 --- /dev/null +++ b/wrappers/cpp/LinphoneCxxConfig.cmake.in @@ -0,0 +1,39 @@ +############################################################################ +# LinphoneCxxConfig.cmake +# Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ +# +# Config file for the Linphone++ package. +# Some components can be asked for: core, tester. +# +# It defines the following variables: +# +# LINPHONE_CXX_FOUND - system has linphone++ +# LINPHONE_CXX_INCLUDE_DIRS - the linphone++ include directory +# LINPHONE_CXX_LIBRARIES - The libraries needed to use linphone++ +# LINPHONE_CXX_LDFLAGS - The linking flags needed to use linphone++ + +find_package(BelleSIP) +include("${CMAKE_CURRENT_LIST_DIR}/LinphoneCxxTargets.cmake") +get_filename_component(LINPHONE_CXX_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(LINPHONE_CXX_INCLUDE_DIRS "${LINPHONE_CXX_CMAKE_DIR}/../../../include") +set(LINPHONE_CXX_LDFLAGS "") +set(LINPHONE_CXX_LIBRARIES linphone++ ${BELLESIP_LIBRARIES}) + diff --git a/wrappers/cpp/c_make_lists.mustache.in b/wrappers/cpp/c_make_lists.mustache.in index 62a8d8542..1585204d2 100644 --- a/wrappers/cpp/c_make_lists.mustache.in +++ b/wrappers/cpp/c_make_lists.mustache.in @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.0) +project(LinphoneCxx VERSION @LINPHONE_VERSION@) + include(GNUInstallDirs) set(GENERATED_SOURCES @@ -37,10 +39,24 @@ set_target_properties(linphone++ PROPERTIES SOVERSION @LINPHONE_SO_VERSION@ ) -install(TARGETS linphone++ +install(TARGETS linphone++ EXPORT LinphoneCxxTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linphone++ ) +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY AnyNewerVersion +) +export(EXPORT LinphoneCxxTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxTargets.cmake" +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxVersion.cmake + ${CMAKE_CURRENT_BINARY_DIR}/LinphoneCxxTargets.cmake + ${CMAKE_CURRENT_SOURCE_DIR}/LinphoneCxxConfig.cmake + DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake +)