From 03fc6bba62921cf7913f8f9585cc1f004ab99cd6 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 6 Mar 2015 10:41:49 +0100 Subject: [PATCH] Generate a config-file package when building with CMake. --- Bcg729Config.cmake | 35 +++++++++++++++++++++++++++++++++++ CMakeLists.txt | 28 ++++++++++++++++++++++++++++ src/CMakeLists.txt | 2 +- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 Bcg729Config.cmake diff --git a/Bcg729Config.cmake b/Bcg729Config.cmake new file mode 100644 index 0000000..89cd8e1 --- /dev/null +++ b/Bcg729Config.cmake @@ -0,0 +1,35 @@ +############################################################################ +# Bcg729Config.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 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ +# +# Config file for the bcg729 package. +# It defines the following variables: +# +# BCG729_FOUND - system has bcg729 +# BCG729_INCLUDE_DIRS - the bcg729 include directory +# BCG729_LIBRARIES - The libraries needed to use bcg729 + +include("${CMAKE_CURRENT_LIST_DIR}/Bcg729Targets.cmake") + +get_filename_component(BCG729_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(BCG729_INCLUDE_DIRS "${BCG729_CMAKE_DIR}/../../../include") +set(BCG729_LIBRARIES BelledonneCommunications::bcg729) +set(BCG729_FOUND 1) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b30bca..32faaaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,3 +76,31 @@ endif() if(ENABLE_TESTS) add_subdirectory(test) endif() + + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/Bcg729ConfigVersion.cmake" + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion +) +export(EXPORT Bcg729Targets + FILE "${CMAKE_CURRENT_BINARY_DIR}/Bcg729Targets.cmake" + NAMESPACE BelledonneCommunications:: +) +configure_file(Bcg729Config.cmake + "${CMAKE_CURRENT_BINARY_DIR}/Bcg729Config.cmake" + COPYONLY +) + +set(ConfigPackageLocation lib/cmake/Bcg729) +install(EXPORT Bcg729Targets + FILE Bcg729Targets.cmake + NAMESPACE BelledonneCommunications:: + DESTINATION ${ConfigPackageLocation} +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/Bcg729Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/Bcg729ConfigVersion.cmake" + DESTINATION ${ConfigPackageLocation} +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 160ad8b..7e694ac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,7 +58,7 @@ if(MSVC) set_target_properties(bcg729 PROPERTIES PREFIX "lib") endif() -install(TARGETS bcg729 +install(TARGETS bcg729 EXPORT Bcg729Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib