mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Use a config-file package instead of a find-module package in CMake.
This commit is contained in:
parent
ed92d805ad
commit
ce1126b290
11 changed files with 239 additions and 98 deletions
|
|
@ -53,7 +53,6 @@ cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENAB
|
|||
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/share/cmake/Modules")
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckSymbolExists)
|
||||
|
|
@ -88,10 +87,7 @@ if(ENABLE_TUNNEL)
|
|||
endif()
|
||||
endif()
|
||||
if(ENABLE_MSG_STORAGE)
|
||||
find_package(Sqlite3)
|
||||
if(NOT SQLITE3_FOUND)
|
||||
message(FATAL_ERROR "Could not find the sqlite3 library!")
|
||||
endif()
|
||||
find_package(Sqlite3 REQUIRED)
|
||||
endif()
|
||||
if(ENABLE_NOTIFY)
|
||||
find_package(Notify)
|
||||
|
|
@ -200,9 +196,29 @@ if(ENABLE_UNIT_TESTS)
|
|||
endif()
|
||||
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLinphone.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindLinphone.cmake)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FindLinphone.cmake
|
||||
DESTINATION share/cmake/Modules
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfigVersion.cmake"
|
||||
VERSION ${LINPHONE_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
export(EXPORT LinphoneTargets
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/LinphoneTargets.cmake"
|
||||
NAMESPACE BelledonneCommunications::
|
||||
)
|
||||
configure_file(cmake/LinphoneConfig.cmake.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfig.cmake"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(ConfigPackageLocation lib/cmake/Linphone)
|
||||
install(EXPORT LinphoneTargets
|
||||
FILE LinphoneTargets.cmake
|
||||
NAMESPACE BelledonneCommunications::
|
||||
DESTINATION ${ConfigPackageLocation}
|
||||
)
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfigVersion.cmake"
|
||||
DESTINATION ${ConfigPackageLocation}
|
||||
)
|
||||
|
|
|
|||
58
cmake/FindCUnit.cmake
Normal file
58
cmake/FindCUnit.cmake
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
############################################################################
|
||||
# FindCUnit.txt
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# - Find the CUnit include file and library
|
||||
#
|
||||
# CUNIT_FOUND - system has CUnit
|
||||
# CUNIT_INCLUDE_DIRS - the CUnit include directory
|
||||
# CUNIT_LIBRARIES - The libraries needed to use CUnit
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckLibraryExists)
|
||||
|
||||
set(_CUNIT_ROOT_PATHS
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
find_path(CUNIT_INCLUDE_DIRS
|
||||
NAMES CUnit/CUnit.h
|
||||
HINTS _CUNIT_ROOT_PATHS
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
if(CUNIT_INCLUDE_DIRS)
|
||||
set(HAVE_CUNIT_CUNIT_H 1)
|
||||
endif()
|
||||
|
||||
find_library(CUNIT_LIBRARIES
|
||||
NAMES cunit
|
||||
HINTS ${_CUNIT_ROOT_PATHS}
|
||||
PATH_SUFFIXES bin lib
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CUnit
|
||||
DEFAULT_MSG
|
||||
CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES
|
||||
)
|
||||
|
||||
mark_as_advanced(CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES)
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
# ICONV_LIBRARIES - The libraries needed to use libiconv
|
||||
|
||||
set(_ICONV_ROOT_PATHS
|
||||
${WITH_ICONV}
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
# INTL_LIBRARIES - The libraries needed to use libintl
|
||||
|
||||
set(_INTL_ROOT_PATHS
|
||||
${WITH_INTL}
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,83 +0,0 @@
|
|||
############################################################################
|
||||
# FindLinphone.cmake
|
||||
# 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
|
||||
# LINPHONE_LDFLAGS - The linking flags needed to use linphone
|
||||
|
||||
find_package(ORTP REQUIRED)
|
||||
find_package(MS2 REQUIRED)
|
||||
find_package(XML2 REQUIRED)
|
||||
find_package(BelleSIP REQUIRED)
|
||||
if(@ENABLE_MSG_STORAGE@)
|
||||
find_package(Sqlite3)
|
||||
endif()
|
||||
|
||||
set(_LINPHONE_ROOT_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})
|
||||
|
||||
if(SQLITE3_FOUND)
|
||||
list(APPEND LINPHONE_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIRS})
|
||||
list(APPEND LINPHONE_LIBRARIES ${SQLITE3_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND LINPHONE_LIBRARIES shlwapi)
|
||||
endif(WIN32)
|
||||
|
||||
list(REMOVE_DUPLICATES LINPHONE_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES LINPHONE_LIBRARIES)
|
||||
set(LINPHONE_CPPFLAGS "${MS2_CPPFLAGS}")
|
||||
set(LINPHONE_LDFLAGS "${MS2_LDFLAGS} ${BELLESIP_LDFLAGS}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Linphone
|
||||
DEFAULT_MSG
|
||||
LINPHONE_INCLUDE_DIRS LINPHONE_LIBRARIES
|
||||
)
|
||||
|
||||
mark_as_advanced(LINPHONE_INCLUDE_DIRS LINPHONE_LIBRARIES LINPHONE_CPPFLAGS LINPHONE_LDFLAGS)
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
# NOTIFY_LIBRARIES - The libraries needed to use libnotify
|
||||
|
||||
set(_NOTIFY_ROOT_PATHS
|
||||
${WITH_NOTIFY}
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ endif()
|
|||
find_package(GTK2 2.18 REQUIRED gtk)
|
||||
|
||||
set(_SOUP_ROOT_PATHS
|
||||
${WITH_SOUP}
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
|
|
|
|||
55
cmake/FindSqlite3.cmake
Normal file
55
cmake/FindSqlite3.cmake
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
############################################################################
|
||||
# FindSqlite3.cmake
|
||||
# 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 sqlite3 include file and library
|
||||
#
|
||||
# SQLITE3_FOUND - system has sqlite3
|
||||
# SQLITE3_INCLUDE_DIRS - the sqlite3 include directory
|
||||
# SQLITE3_LIBRARIES - The libraries needed to use sqlite3
|
||||
|
||||
set(_SQLITE3_ROOT_PATHS
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
find_path(SQLITE3_INCLUDE_DIRS
|
||||
NAMES sqlite3.h
|
||||
HINTS _SQLITE3_ROOT_PATHS
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
if(SQLITE3_INCLUDE_DIRS)
|
||||
set(HAVE_SQLITE3_H 1)
|
||||
endif()
|
||||
|
||||
find_library(SQLITE3_LIBRARIES
|
||||
NAMES sqlite3
|
||||
HINTS ${_SQLITE3_ROOT_PATHS}
|
||||
PATH_SUFFIXES bin lib
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Sqlite3
|
||||
DEFAULT_MSG
|
||||
SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES HAVE_SQLITE3_H
|
||||
)
|
||||
|
||||
mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES HAVE_SQLITE3_H)
|
||||
55
cmake/FindXML2.cmake
Normal file
55
cmake/FindXML2.cmake
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
############################################################################
|
||||
# FindXML2.txt
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# - Find the libxml2 include file and library
|
||||
#
|
||||
# XML2_FOUND - system has libxml2
|
||||
# XML2_INCLUDE_DIRS - the libxml2 include directory
|
||||
# XML2_LIBRARIES - The libraries needed to use libxml2
|
||||
|
||||
set(_XML2_ROOT_PATHS
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
find_path(XML2_INCLUDE_DIRS
|
||||
NAMES libxml/xmlreader.h
|
||||
HINTS _XML2_ROOT_PATHS
|
||||
PATH_SUFFIXES include/libxml2
|
||||
)
|
||||
|
||||
if(XML2_INCLUDE_DIRS)
|
||||
set(HAVE_LIBXML_XMLREADER_H 1)
|
||||
endif()
|
||||
|
||||
find_library(XML2_LIBRARIES
|
||||
NAMES xml2
|
||||
HINTS ${_XML2_ROOT_PATHS}
|
||||
PATH_SUFFIXES bin lib
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(XML2
|
||||
DEFAULT_MSG
|
||||
XML2_INCLUDE_DIRS XML2_LIBRARIES
|
||||
)
|
||||
|
||||
mark_as_advanced(XML2_INCLUDE_DIRS XML2_LIBRARIES)
|
||||
44
cmake/LinphoneConfig.cmake.in
Normal file
44
cmake/LinphoneConfig.cmake.in
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
############################################################################
|
||||
# LinphoneConfig.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 belle-sip package.
|
||||
# It defines the following variables:
|
||||
#
|
||||
# LINPHONE_FOUND - system has linphone
|
||||
# LINPHONE_INCLUDE_DIRS - the linphone include directory
|
||||
# LINPHONE_LIBRARIES - The libraries needed to use linphone
|
||||
# LINPHONE_LDFLAGS - The linking flags needed to use linphone
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/LinphoneTargets.cmake")
|
||||
if(@ENABLE_TUNNEL@)
|
||||
find_package(Tunnel)
|
||||
endif()
|
||||
|
||||
get_filename_component(LINPHONE_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
set(LINPHONE_INCLUDE_DIRS "${LINPHONE_CMAKE_DIR}/../../../include")
|
||||
set(LINPHONE_LIBRARIES BelledonneCommunications::linphone)
|
||||
set(LINPHONE_LDFLAGS @LINK_FLAGS@)
|
||||
if(TUNNEL_FOUND)
|
||||
list(APPEND LINPHONE_INCLUDE_DIRS ${TUNNEL_INCLUDE_DIRS})
|
||||
list(APPEND LINPHONE_LIBRARIES ${TUNNEL_LIBRARIES})
|
||||
endif()
|
||||
set(LINPHONE_FOUND 1)
|
||||
|
|
@ -159,7 +159,7 @@ if(ICONV_FOUND)
|
|||
target_include_directories(linphone PUBLIC ${ICONV_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
install(TARGETS linphone
|
||||
install(TARGETS linphone EXPORT LinphoneTargets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue