From c3d44a10f76562d3771cb7fc4c019abf53b7326e Mon Sep 17 00:00:00 2001 From: Ghislain MARY <ghislain.mary@belledonne-communications.com> Date: Wed, 21 Jun 2023 14:31:32 +0200 Subject: [PATCH] Improve CMake package config and find_package scripts. --- CMakeLists.txt | 198 ++++++++---------------- README.md | 2 +- build/CMakeLists.txt | 4 +- cmake/FindBZRTP.cmake | 43 ------ cmake/FindBcToolbox.cmake | 67 --------- cmake/FindBelcard.cmake | 43 ------ cmake/FindBelleSIP.cmake | 45 ------ cmake/FindBelr.cmake | 43 ------ cmake/FindCpuFeatures.cmake | 53 ------- cmake/FindIconv.cmake | 57 ------- cmake/FindIntegratedXercesC.cmake | 42 ------ cmake/FindIntegratedZLIB.cmake | 42 ------ cmake/FindJsonCPP.cmake | 55 +++++-- cmake/FindMediastreamer2.cmake | 46 ------ cmake/FindNotify.cmake | 55 ------- cmake/FindOpenLDAP.cmake | 105 ++++++++++--- cmake/FindOrtp.cmake | 43 ------ cmake/FindSASL.cmake | 45 ------ cmake/FindSoci.cmake | 200 ++++++++++++++----------- cmake/FindSqlite3.cmake | 67 --------- cmake/FindSupport.cmake | 46 ------ cmake/FindTunnel.cmake | 43 ------ cmake/FindTurboJpeg.cmake | 79 ++++++---- cmake/FindXML2.cmake | 67 --------- cmake/FindZXing.cmake | 66 ++++++-- cmake/LibLinphoneConfig.cmake.in | 97 ++++++++++++ cmake/LinphoneConfig.cmake.in | 55 ------- config.h.cmake | 2 - console/CMakeLists.txt | 12 +- coreapi/CMakeLists.txt | 36 +++-- coreapi/help/examples/C/CMakeLists.txt | 9 +- daemon/CMakeLists.txt | 10 +- plugins/example/CMakeLists.txt | 20 +-- src/CMakeLists.txt | 127 +++++++--------- tester/CMakeLists.txt | 52 +++---- tools/CMakeLists.txt | 24 ++- wrappers/cpp/CMakeLists.txt | 2 +- wrappers/swift/CMakeLists.txt | 7 +- 38 files changed, 628 insertions(+), 1381 deletions(-) delete mode 100644 cmake/FindBZRTP.cmake delete mode 100644 cmake/FindBcToolbox.cmake delete mode 100644 cmake/FindBelcard.cmake delete mode 100644 cmake/FindBelleSIP.cmake delete mode 100644 cmake/FindBelr.cmake delete mode 100644 cmake/FindCpuFeatures.cmake delete mode 100644 cmake/FindIconv.cmake delete mode 100644 cmake/FindIntegratedXercesC.cmake delete mode 100644 cmake/FindIntegratedZLIB.cmake delete mode 100644 cmake/FindMediastreamer2.cmake delete mode 100644 cmake/FindNotify.cmake delete mode 100644 cmake/FindOrtp.cmake delete mode 100644 cmake/FindSASL.cmake delete mode 100644 cmake/FindSqlite3.cmake delete mode 100644 cmake/FindSupport.cmake delete mode 100644 cmake/FindTunnel.cmake delete mode 100644 cmake/FindXML2.cmake create mode 100644 cmake/LibLinphoneConfig.cmake.in delete mode 100644 cmake/LinphoneConfig.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d7ad74ffb..d907f0518a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ cmake_minimum_required(VERSION 3.22) -project(linphone VERSION 5.3.0 LANGUAGES C CXX) +project(LibLinphone VERSION 5.3.0 LANGUAGES C CXX) set(LINPHONE_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) @@ -66,15 +66,12 @@ option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES) option(ENABLE_VCARD "Turn on compilation of vcard4 support." YES) option(ENABLE_VIDEO "Build with video support." YES) option(ENABLE_ASSETS "Package sound assets." YES) -option(ENABLE_PACKAGE_SOURCE "Create 'package_source' target for source archive making (CMake >= 3.11)" OFF) +option(ENABLE_PACKAGE_SOURCE "Create 'package_source' target for source archive making" OFF) option(ENABLE_SQLITE "Build with sqlite support" YES) option(ENABLE_XML2 "Build with libxml2 support - for presence feature mainly" YES) option(ENABLE_EXAMPLE_PLUGIN "Enable build of the example plugin" NO) option(ENABLE_EKT_SERVER_PLUGIN "Enable build of the EKT encryption plugin" NO) -cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI;NOT APPLE" NO) -cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO) - option(ENABLE_SRTP "Build with the SRTP transport support." YES) cmake_dependent_option(ENABLE_ZRTP "Build with ZRTP support." YES "ENABLE_SRTP" NO) cmake_dependent_option(ENABLE_GOCLEAR "Build with ZRTP GoClear message support (RFC 6189 - section 5.11)." YES "ENABLE_ZRTP" NO) @@ -92,11 +89,8 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") endif() set(LINPHONE_LIBS_FOR_TOOLS liblinphone) -if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - list(APPEND LINPHONE_LIBS_FOR_TOOLS "Ws2_32" "Iphlpapi" "user32") -endif() -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") include(CheckSymbolExists) include(CheckLibraryExists) @@ -116,43 +110,18 @@ endif() # find_package should be invoked here to check for libraries - however do NOT # call include_directories here (see below) if(ENABLE_VCARD) - find_package(Belcard) - if(NOT BELCARD_FOUND) - find_package(belcard CONFIG REQUIRED) - endif() + find_package(BelCard 5.3.0 REQUIRED) add_definitions(-DVCARD_ENABLED) endif() -find_package(BelleSIP) -if(NOT BELLESIP_FOUND) - find_package(BelleSIP CONFIG REQUIRED) -endif() -find_package(Mediastreamer2) -if(NOT MEDIASTREAMER2_FOUND) - find_package(Mediastreamer2 CONFIG REQUIRED) -endif() -find_package(Ortp) -if(NOT ORTP_FOUND) - find_package(ortp CONFIG REQUIRED) -endif() -find_package(BcToolbox) -if(NOT BCTOOLBOX_FOUND) - find_package(bctoolbox 0.0.3 CONFIG REQUIRED OPTIONAL_COMPONENTS tester) -endif() -find_package(Belr) -if(NOT BELR_FOUND) - find_package(belr CONFIG REQUIRED) -endif() +find_package(BelleSIP 5.3.0 REQUIRED) +find_package(Mediastreamer2 5.3.0 REQUIRED) +find_package(Ortp 5.3.0 REQUIRED) +find_package(BCToolbox 5.3.0 REQUIRED OPTIONAL_COMPONENTS tester) +find_package(Belr 5.3.0 REQUIRED) if(ENABLE_ADVANCED_IM) - find_package(IntegratedXercesC) - if(INTEGRATEDXERCESC_FOUND) - set(XercesC_FOUND 1) - set(XercesC_TARGET "xerces-c") - else() - find_package(XercesC REQUIRED) - set(XercesC_TARGET "XercesC::XercesC") - endif() + bc_find_package(XercesC XercesC::XercesC xerces-c REQUIRED) set(HAVE_ADVANCED_IM 1) set(LIBXSD_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/libxsd") endif() @@ -169,18 +138,18 @@ if(ENABLE_ZRTP) endif() if(ENABLE_SQLITE) - find_package(Sqlite3 REQUIRED) + bc_find_package(SQLite3 SQLite::SQLite3 sqlite3 REQUIRED) add_definitions(-DHAVE_SQLITE) endif() if(ENABLE_XML2) - find_package(XML2 REQUIRED) + bc_find_package(LibXml2 LibXml2::LibXml2 xml2 REQUIRED) add_definitions(-DHAVE_XML2) endif() if(ENABLE_DB_STORAGE) # APPLE platform does not use dlopen for soci backend - if (APPLE OR ANDROID) + if(APPLE OR ANDROID) find_package(Soci REQUIRED COMPONENTS sqlite3) else() find_package(Soci REQUIRED) @@ -188,38 +157,21 @@ if(ENABLE_DB_STORAGE) set(HAVE_DB_STORAGE 1) endif() -find_package(IntegratedZLIB) -if(INTEGRATEDZLIB_FOUND) - set(ZLIB_FOUND 1) -else() - find_package(ZLIB) +bc_find_package(ZLIB ZLIB::ZLIB zlib) +if(ZLIB_FOUND) + set(HAVE_ZLIB 1) endif() if(ENABLE_TUNNEL) - find_package(Tunnel) - if(NOT TUNNEL_FOUND) + find_package(Tunnel 0.7.0) + if(NOT Tunnel_FOUND) message(WARNING "Could not find the tunnel library!") set(ENABLE_TUNNEL OFF CACHE BOOL "Enable tunnel support." FORCE) endif() endif() -if(ENABLE_NOTIFY) - find_package(Notify) - if(NOTIFY_FOUND) - set(HAVE_NOTIFY4 1) - else() - message(WARNING "Could not find the notify library!") - set(ENABLE_NOTIFY OFF CACHE BOOL "Enable libnotify support." FORCE) - endif() -endif() -if(ENABLE_ASSISTANT) - set(BUILD_WIZARD 1) -endif() if(ENABLE_LIME_X3DH) - find_package(BZRTP) - if(NOT BZRTP_FOUND) - find_package(BZRTP REQUIRED CONFIG) - endif() - bc_find_package(lime REQUIRED CONFIG) + find_package(BZRTP 5.3.0 REQUIRED) + find_package(Lime 5.3.0 REQUIRED) set(HAVE_LIME_X3DH 1) endif() if(ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_JAVA_WRAPPER OR ENABLE_SWIFT_WRAPPER OR ENABLE_DOC) @@ -235,17 +187,14 @@ if(ENABLE_LDAP) endif() if(ENABLE_FLEXIAPI) - find_package(JsonCPP) - if(NOT JSONCPP_FOUND) - find_package(jsoncpp REQUIRED) - endif() + find_package(JsonCPP REQUIRED) set(HAVE_FLEXIAPI TRUE) endif() if(ENABLE_QRCODE) find_package(ZXing REQUIRED) add_definitions(-DQRCODE_ENABLED) - if(ENABLE_JPEG)# only needed for QRCode. Move from it for other + if(ENABLE_JPEG) # Only needed for QRCode. Move from it for other add_definitions(-DJPEG_ENABLED) find_package(TurboJpeg REQUIRED) endif() @@ -268,8 +217,6 @@ if(ANDROID) endif() endif() -set(LINPHONE_LDFLAGS "${BELLESIP_LDFLAGS} ${MEDIASTREAMER2_LDFLAGS}") - # include_directories must be called only UNDER THIS LINE in order to use our # projects submodules first (we do NOT want to have system headers in first position) include_directories( @@ -280,51 +227,18 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/coreapi/ ) set(LINPHONE_INCLUDE_DIRS - ${BELLESIP_INCLUDE_DIRS} - ${MEDIASTREAMER2_INCLUDE_DIRS} - ${BCTOOLBOX_CORE_INCLUDE_DIRS} - ${BELR_INCLUDE_DIRS} ${LIBXSD_INCLUDE_DIRS} - ${XercesC_INCLUDE_DIRS} ) if(ANDROID) include_directories(${CMAKE_CURRENT_BINARY_DIR}/java) endif() -if(ENABLE_TUNNEL) - list(APPEND LINPHONE_INCLUDE_DIRS ${TUNNEL_INCLUDE_DIRS}) -endif() -if(ENABLE_XML2) - list(APPEND LINPHONE_INCLUDE_DIRS ${XML2_INCLUDE_DIRS}) +if(ZXing_FOUND AND ZXing_USE_BUILD_INTERFACE) + add_compile_definitions("ZXING_USE_BUILD_INTERFACE") endif() -if(ENABLE_SQLITE) - list(APPEND LINPHONE_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIRS}) -endif() - -if(ZLIB_FOUND) - list(APPEND LINPHONE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) - set(HAVE_ZLIB 1) -endif() -if(INTL_FOUND) - set(HAVE_INTL 1) - list(APPEND LINPHONE_INCLUDE_DIRS ${INTL_INCLUDE_DIRS}) -endif() -if(OPENLDAP_FOUND) - list(APPEND LINPHONE_INCLUDE_DIRS ${OPENLDAP_INCLUDE_DIRS}) -endif() -if(ZXING_FOUND) - list(APPEND LINPHONE_INCLUDE_DIRS ${ZXING_INCLUDE_DIRS}) - if(ZXING_USE_BUILD_INTERFACE) - add_compile_definitions("ZXING_USE_BUILD_INTERFACE") - endif() -endif() -if(TURBOJPEG_FOUND) - list(APPEND LINPHONE_INCLUDE_DIRS ${TURBOJPEG_INCLUDE_DIRS}) -endif() - -set(LINPHONE_CPPFLAGS ${BELCARD_CPPFLAGS} ${BELLESIP_CPPFLAGS} ${MEDIASTREAMER2_CPPFLAGS} ${BCTOOLBOX_CPPFLAGS} ${BELR_CPPFLAGS}) +set(LINPHONE_CPPFLAGS ) if(NOT BUILD_SHARED_LIBS) list(APPEND LINPHONE_CPPFLAGS "-DLINPHONE_STATIC") endif() @@ -425,28 +339,28 @@ set(PACKAGE_FREEDESKTOP_DIR "${PACKAGE_DATA_DIR}/applications") set(LINPHONE_FRAMEWORK_VERSION "A") if(APPLE AND NOT IOS) - set(LINPHONE_PLUGINS_LOCATION "Frameworks/linphone.framework/Versions/${LINPHONE_FRAMEWORK_VERSION}/Libraries") - install(DIRECTORY DESTINATION "${CMAKE_INSTALL_PREFIX}/${LINPHONE_PLUGINS_LOCATION}") - + set(LIBLINPHONE_PLUGINS_DIR "Frameworks/linphone.framework/Versions/${LINPHONE_FRAMEWORK_VERSION}/Libraries") if (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/Frameworks/linphone.framework/Libraries") install(CODE "execute_process(COMMAND sh -c \"ln -sf Versions/Current/Libraries ${CMAKE_INSTALL_PREFIX}/Frameworks/linphone.framework/Libraries\")") endif() else() - set(LINPHONE_PLUGINS_LOCATION "${CMAKE_INSTALL_LIBDIR}/liblinphone/plugins") + set(LIBLINPHONE_PLUGINS_DIR "${CMAKE_INSTALL_LIBDIR}/liblinphone/plugins") endif() +define_property(TARGET PROPERTY "LIBLINPHONE_PLUGINS_DIR" BRIEF_DOCS "Stores the location of liblinphone plugins" FULL_DOCS "Stores the location of liblinphone plugins") +install(DIRECTORY DESTINATION "${CMAKE_INSTALL_PREFIX}/${LIBLINPHONE_PLUGINS_DIR}") if(ENABLE_RELATIVE_PREFIX) if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") set(LINPHONE_PACKAGE_PLUGINS_DIR "." CACHE STRING "Folder where plugins loaded by liblinphone must be stored") else() - set(LINPHONE_PACKAGE_PLUGINS_DIR "./${LINPHONE_PLUGINS_LOCATION}" CACHE STRING "Folder where plugins loaded by liblinphone must be stored") + set(LINPHONE_PACKAGE_PLUGINS_DIR "./${LINPHONE_PLUGINS_DIR}" CACHE STRING "Folder where plugins loaded by liblinphone must be stored") endif() else() - set(LINPHONE_PACKAGE_PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/${LINPHONE_PLUGINS_LOCATION}" CACHE STRING "Folder where plugins loaded by liblinphone must be stored") + set(LINPHONE_PACKAGE_PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/${LINPHONE_PLUGINS_DIR}" CACHE STRING "Folder where plugins loaded by liblinphone must be stored") endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) -set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/config.h PROPERTIES GENERATED ON) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h") +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/config.h" PROPERTIES GENERATED ON) add_definitions(-DHAVE_CONFIG_H) if(ENABLE_VIDEO) @@ -469,8 +383,6 @@ if(ENABLE_EKT_SERVER_PLUGIN) add_definitions(-DHAVE_EKT_SERVER_PLUGIN) endif() -set(EXPORT_TARGETS_NAME "Linphone") - add_subdirectory(include) if(ENABLE_JAVA_WRAPPER) add_subdirectory(wrappers/java) @@ -505,27 +417,37 @@ if(ENABLE_UNIT_TESTS) endif() include(CMakePackageConfigHelpers) -set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/Linphone/cmake") - -write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfigVersion.cmake" - VERSION ${LINPHONE_VERSION} +set(CMAKE_MODULES_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake") +configure_package_config_file("cmake/${PROJECT_NAME}Config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION "${CMAKE_MODULES_INSTALL_DIR}" + PATH_VARS LIBLINPHONE_PLUGINS_DIR +) +write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion ) -configure_package_config_file(cmake/LinphoneConfig.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfig.cmake" - INSTALL_DESTINATION ${CONFIG_PACKAGE_LOCATION} - NO_SET_AND_CHECK_MACRO +install(FILES + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + DESTINATION ${CMAKE_MODULES_INSTALL_DIR} ) -install(EXPORT ${EXPORT_TARGETS_NAME}Targets - FILE LinphoneTargets.cmake - DESTINATION ${CONFIG_PACKAGE_LOCATION} -) -install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/LinphoneConfigVersion.cmake" - DESTINATION ${CONFIG_PACKAGE_LOCATION} +if(Soci_FOUND) + install(FILES "cmake/FindSoci.cmake" DESTINATION ${CMAKE_MODULES_INSTALL_DIR}) +endif() +if(OpenLDAP_FOUND) + install(FILES "cmake/FindOpenLDAP.cmake" DESTINATION ${CMAKE_MODULES_INSTALL_DIR}) +endif() +if(ZXing_FOUND) + install(FILES "cmake/FindZXing.cmake" DESTINATION ${CMAKE_MODULES_INSTALL_DIR}) +endif() +if(TurboJpeg_FOUND) + install(FILES "cmake/FindTurboJpeg.cmake" DESTINATION ${CMAKE_MODULES_INSTALL_DIR}) +endif() + +install(EXPORT ${PROJECT_NAME}Targets + FILE "${PROJECT_NAME}Targets.cmake" + DESTINATION ${CMAKE_MODULES_INSTALL_DIR} ) if (ENABLE_PACKAGE_SOURCE) diff --git a/README.md b/README.md index 950e34db1c..9c5dfdb94a 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Here the main dependencies listed: * **`ENABLE_UNIT_TESTS=NO`** : do not build testing binaries * **`ENABLE_VCARD=NO`** : disable VCard4 support * **`ENABLE_TOOLS=NO`** : do not build tool binaries -* **`ENABLE_LIME=NO`** : disable Linphone Instant Messaging Encryption +* **`ENABLE_LIME_X3DH=NO`** : disable Linphone Instant Messaging Encryption ## Note for packagers diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index c6ad8e9aa7..e8c59da279 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # CMakeLists.txt -# Copyright (c) 2010-2022 Belledonne Communications SARL. +# Copyright (c) 2010-2023 Belledonne Communications SARL. # ############################################################################ # @@ -21,8 +21,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. ############################################################################ -cmake_minimum_required(VERSION 3.11) # we need CMake 3.11 for defining 'package_source' target as custom target - if(NOT CPACK_PACKAGE_NAME) set(CPACK_PACKAGE_NAME "liblinphone") endif() diff --git a/cmake/FindBZRTP.cmake b/cmake/FindBZRTP.cmake deleted file mode 100644 index 1ac4d94299..0000000000 --- a/cmake/FindBZRTP.cmake +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# FindBZRTP.cmake -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the bzrtp include files and library -# -# BZRTP_FOUND - system has lib bzrtp -# BZRTP_INCLUDE_DIRS - the bzrtp include directory -# BZRTP_LIBRARIES - The library needed to use bzrtp - -if(TARGET bzrtp) - - set(BZRTP_LIBRARIES bzrtp) - get_target_property(BZRTP_INCLUDE_DIRS bzrtp INTERFACE_INCLUDE_DIRECTORIES) - - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(BZRTP - DEFAULT_MSG - BZRTP_INCLUDE_DIRS BZRTP_LIBRARIES - ) - - mark_as_advanced(BZRTP_INCLUDE_DIRS BZRTP_LIBRARIES) - -endif() diff --git a/cmake/FindBcToolbox.cmake b/cmake/FindBcToolbox.cmake deleted file mode 100644 index 57664786f2..0000000000 --- a/cmake/FindBcToolbox.cmake +++ /dev/null @@ -1,67 +0,0 @@ -############################################################################ -# FindBctoolbox.cmake -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the bctoolbox include files and library -# -# BCTOOLBOX_FOUND - System has lib bctoolbox -# BCTOOLBOX_INCLUDE_DIRS - The bctoolbox include directories -# BCTOOLBOX_LIBRARIES - The libraries needed to use bctoolbox -# BCTOOLBOX_CMAKE_DIR - The bctoolbox cmake directory -# BCTOOLBOX_CORE_FOUND - System has core bctoolbox -# BCTOOLBOX_CORE_INCLUDE_DIRS - The core bctoolbox include directories -# BCTOOLBOX_CORE_LIBRARIES - The core bctoolbox libraries -# BCTOOLBOX_TESTER_FOUND - System has bctoolbox tester -# BCTOOLBOX_TESTER_INCLUDE_DIRS - The bctoolbox tester include directories -# BCTOOLBOX_TESTER_LIBRARIES - The bctoolbox tester libraries - -if(TARGET bctoolbox) - - set(BCTOOLBOX_CORE_LIBRARIES bctoolbox) - get_target_property(BCTOOLBOX_CORE_INCLUDE_DIRS bctoolbox INTERFACE_INCLUDE_DIRECTORIES) - set(BCTOOLBOX_CORE_FOUND TRUE) - get_target_property(BCTOOLBOX_SOURCE_DIR bctoolbox SOURCE_DIR) - set(BCTOOLBOX_CMAKE_DIR "${BCTOOLBOX_SOURCE_DIR}/../cmake") - if(TARGET bctoolbox-tester) - set(BCTOOLBOX_TESTER_LIBRARIES bctoolbox-tester) - get_target_property(BCTOOLBOX_TESTER_INCLUDE_DIRS bctoolbox-tester INTERFACE_INCLUDE_DIRECTORIES) - set(BCTOOLBOX_TESTER_FOUND TRUE) - set(BCTOOLBOX_TESTER_COMPONENT_VARIABLES BCTOOLBOX_TESTER_FOUND BCTOOLBOX_TESTER_INCLUDE_DIRS BCTOOLBOX_TESTER_LIBRARIES) - endif() - set(BCTOOLBOX_LIBRARIES ${BCTOOLBOX_CORE_LIBRARIES} ${BCTOOLBOX_TESTER_LIBRARIES}) - set(BCTOOLBOX_INCLUDE_DIRS ${BCTOOLBOX_CORE_INCLUDE_DIRS} ${BCTOOLBOX_TESTER_INCLUDE_DIRS}) - - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(BcToolbox - DEFAULT_MSG - BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES BCTOOLBOX_CMAKE_DIR - BCTOOLBOX_CORE_FOUND BCTOOLBOX_CORE_INCLUDE_DIRS BCTOOLBOX_CORE_LIBRARIES - ${BCTOOLBOX_TESTER_COMPONENT_VARIABLES} - ) - - mark_as_advanced( - BCTOOLBOX_INCLUDE_DIRS BCTOOLBOX_LIBRARIES BCTOOLBOX_CMAKE_DIR - BCTOOLBOX_CORE_FOUND BCTOOLBOX_CORE_INCLUDE_DIRS BCTOOLBOX_CORE_LIBRARIES - ${BCTOOLBOX_TESTER_COMPONENT_VARIABLES} - ) - -endif() diff --git a/cmake/FindBelcard.cmake b/cmake/FindBelcard.cmake deleted file mode 100644 index f5a26151c6..0000000000 --- a/cmake/FindBelcard.cmake +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# FindBelcard.cmake -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the belcard include files and library -# -# BELCARD_FOUND - system has lib belcard -# BELCARD_INCLUDE_DIRS - the belcard include directory -# BELCARD_LIBRARIES - The library needed to use belcard - -if(TARGET belcard) - - set(BELCARD_LIBRARIES belcard) - get_target_property(BELCARD_INCLUDE_DIRS belcard INTERFACE_INCLUDE_DIRECTORIES) - - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Belcard - DEFAULT_MSG - BELCARD_INCLUDE_DIRS BELCARD_LIBRARIES - ) - - mark_as_advanced(BELCARD_INCLUDE_DIRS BELCARD_LIBRARIES) - -endif() diff --git a/cmake/FindBelleSIP.cmake b/cmake/FindBelleSIP.cmake deleted file mode 100644 index 42a3e07c9c..0000000000 --- a/cmake/FindBelleSIP.cmake +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# FindBelleSIP.cmake -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the bellesip include files and library -# -# BELLESIP_FOUND - system has lib bellesip -# BELLESIP_INCLUDE_DIRS - the bellesip include directory -# BELLESIP_LIBRARIES - The library needed to use bellesip -# BELLESIP_TARGETNAME - The target name for the bellesip library - -if(TARGET belle-sip) - - set(BELLESIP_LIBRARIES belle-sip) - set(BELLESIP_TARGETNAME belle-sip) - get_target_property(BELLESIP_INCLUDE_DIRS belle-sip INTERFACE_INCLUDE_DIRECTORIES) - - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(BelleSIP - DEFAULT_MSG - BELLESIP_INCLUDE_DIRS BELLESIP_LIBRARIES - ) - - mark_as_advanced(BELLESIP_INCLUDE_DIRS BELLESIP_LIBRARIES) - -endif() diff --git a/cmake/FindBelr.cmake b/cmake/FindBelr.cmake deleted file mode 100644 index 0cca84a6bb..0000000000 --- a/cmake/FindBelr.cmake +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# FindBelr.cmake -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the belr include files and library -# -# BELR_FOUND - system has lib belr -# BELR_INCLUDE_DIRS - the belr include directory -# BELR_LIBRARIES - The library needed to use belr - -if(TARGET belr) - - set(BELR_LIBRARIES belr) - get_target_property(BELR_INCLUDE_DIRS belr INTERFACE_INCLUDE_DIRECTORIES) - - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Belr - DEFAULT_MSG - BELR_INCLUDE_DIRS BELR_LIBRARIES - ) - - mark_as_advanced(BELR_INCLUDE_DIRS BELR_LIBRARIES) - -endif() diff --git a/cmake/FindCpuFeatures.cmake b/cmake/FindCpuFeatures.cmake deleted file mode 100644 index 37f92f56fc..0000000000 --- a/cmake/FindCpuFeatures.cmake +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################ -# FindCpuFeatures.cmake -# Copyright (C) 2017-2023 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. -# -############################################################################ -# -# - Find the Android cpufeatures include file and library -# -# CPUFEATURES_FOUND - system has libcpufeatures -# CPUFEATURES_INCLUDE_DIRS - The libcpufeatures include directory -# CPUFEATURES_LIBRARIES - The libraries needed to use libcpufeatures - -if(TARGET cpufeatures) - - set(CPUFEATURES_LIBRARIES cpufeatures) - get_target_property(CPUFEATURES_INCLUDE_DIRS cpufeatures INTERFACE_INCLUDE_DIRECTORIES) - -else() - - find_library(CPUFEATURES_LIBRARIES - NAMES cpufeatures - ) - find_path(CPUFEATURES_INCLUDE_DIRS - NAMES cpu-features.h - PATH_SUFFIXES include - ) - -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CpuFeatures - DEFAULT_MSG - CPUFEATURES_INCLUDE_DIRS - CPUFEATURES_LIBRARIES -) - -mark_as_advanced(CPUFEATURES_INCLUDE_DIRS CPUFEATURES_LIBRARIES) diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake deleted file mode 100644 index d238426c78..0000000000 --- a/cmake/FindIconv.cmake +++ /dev/null @@ -1,57 +0,0 @@ -############################################################################ -# FindIconv.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -############################################################################ -# -# - Find the iconv include file and library -# -# ICONV_FOUND - system has libiconv -# ICONV_INCLUDE_DIRS - the libiconv include directory -# ICONV_LIBRARIES - The libraries needed to use libiconv - -if(APPLE AND NOT IOS) - set(ICONV_HINTS "${CMAKE_OSX_SYSROOT}/usr" "/usr") -endif() -if(ICONV_HINTS) - set(ICONV_LIBRARIES_HINTS "${ICONV_HINTS}/lib") -endif() - -find_path(ICONV_INCLUDE_DIRS - NAMES iconv.h - HINTS "${ICONV_HINTS}" - PATH_SUFFIXES include -) - -if(ICONV_INCLUDE_DIRS) - set(HAVE_ICONV_H 1) -endif() - -find_library(ICONV_LIBRARIES - NAMES iconv - HINTS "${ICONV_LIBRARIES_HINTS}" -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Iconv - DEFAULT_MSG - ICONV_INCLUDE_DIRS ICONV_LIBRARIES HAVE_ICONV_H -) - -mark_as_advanced(ICONV_INCLUDE_DIRS ICONV_LIBRARIES HAVE_ICONV_H) diff --git a/cmake/FindIntegratedXercesC.cmake b/cmake/FindIntegratedXercesC.cmake deleted file mode 100644 index e903a47111..0000000000 --- a/cmake/FindIntegratedXercesC.cmake +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# FindIntegratedXercesC.txt -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the xercesc include file and library -# -# XercesC_FOUND - system has xercesc -# XercesC_INCLUDE_DIRS - the xercesc include directory -# XercesC_LIBRARIES - The libraries needed to use xercesc - -if(TARGET xerces-c) - - set(XercesC_LIBRARIES xerces-c) - get_target_property(XercesC_INCLUDE_DIRS xerces-c INTERFACE_INCLUDE_DIRECTORIES) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(IntegratedXercesC - DEFAULT_MSG - XercesC_INCLUDE_DIRS XercesC_LIBRARIES - ) - - mark_as_advanced(XercesC_INCLUDE_DIRS XercesC_LIBRARIES) - -endif() diff --git a/cmake/FindIntegratedZLIB.cmake b/cmake/FindIntegratedZLIB.cmake deleted file mode 100644 index ca8bf5613d..0000000000 --- a/cmake/FindIntegratedZLIB.cmake +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# FindIntegratedZLIB.txt -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the zlib include file and library -# -# ZLIB_FOUND - system has zlib -# ZLIB_INCLUDE_DIRS - the zlib include directory -# ZLIB_LIBRARIES - The libraries needed to use zlib - -if(TARGET zlib) - - set(ZLIB_LIBRARIES zlib) - get_target_property(ZLIB_INCLUDE_DIRS zlib INTERFACE_INCLUDE_DIRECTORIES) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(IntegratedZLIB - DEFAULT_MSG - ZLIB_INCLUDE_DIRS ZLIB_LIBRARIES - ) - - mark_as_advanced(ZLIB_INCLUDE_DIRS ZLIB_LIBRARIES) - -endif() diff --git a/cmake/FindJsonCPP.cmake b/cmake/FindJsonCPP.cmake index b84cef70a9..0f81b4be4e 100644 --- a/cmake/FindJsonCPP.cmake +++ b/cmake/FindJsonCPP.cmake @@ -20,29 +20,64 @@ # ############################################################################ # -# - Find the jsoncpp include files and library +# Find the jsoncpp library. # -# JSONCPP_FOUND - system has lib jsoncpp -# JSONCPP_INCLUDE_DIRS - the jsoncpp include directory -# JSONCPP_LIBRARIES - The library needed to use jsoncpp +# Targets +# ^^^^^^^ +# +# The following targets may be defined: +# +# jsoncpp_lib - If the jsoncpp library has been found and is a shared lib +# jsoncpp_static - If the jsoncpp library has been found and is a static lib +# +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# JsonCPP_FOUND - The jsoncpp library has been found +# JsonCPP_TARGET - The name of the CMake target for the jsoncpp library + if(TARGET jsoncpp_lib OR TARGET jsoncpp_static) if(TARGET jsoncpp_lib) - set(JSONCPP_LIBRARIES jsoncpp_lib) - get_target_property(JSONCPP_INCLUDE_DIRS jsoncpp_lib INTERFACE_INCLUDE_DIRECTORIES) + set(JsonCPP_TARGET jsoncpp_lib) else() - set(JSONCPP_LIBRARIES jsoncpp_static) - get_target_property(JSONCPP_INCLUDE_DIRS jsoncpp_static INTERFACE_INCLUDE_DIRECTORIES) + set(JsonCPP_TARGET jsoncpp_static) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(JsonCPP DEFAULT_MSG - JSONCPP_INCLUDE_DIRS JSONCPP_LIBRARIES + JsonCPP_TARGET ) + mark_as_advanced(JsonCPP_TARGET) - mark_as_advanced(JSONCPP_INCLUDE_DIRS JSONCPP_LIBRARIES) +else() + + set(_OPTIONS "CONFIG") + if(JsonCPP_FIND_REQUIRED) + list(APPEND _OPTIONS "REQUIRED") + endif() + if(JsonCPP_FIND_QUIETLY) + list(APPEND _OPTIONS "QUIET") + endif() + if(JsonCPP_FIND_VERSION) + list(PREPEND _OPTIONS "${jsoncpp_FIND_VERSION}") + endif() + if(JsonCPP_FIND_EXACT) + list(APPEND _OPTIONS "EXACT") + endif() + + find_package(jsoncpp ${_OPTIONS}) + + if(TARGET jsoncpp_lib) + set(JsonCPP_TARGET jsoncpp_lib) + else() + set(JsonCPP_TARGET jsoncpp_static) + endif() endif() diff --git a/cmake/FindMediastreamer2.cmake b/cmake/FindMediastreamer2.cmake deleted file mode 100644 index 64ac8f284e..0000000000 --- a/cmake/FindMediastreamer2.cmake +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# FindMediastreamer2.cmake -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the mediastreamer2 include files and library -# -# MEDIASTREAMER2_FOUND - system has lib mediastreamer2 -# MEDIASTREAMER2_INCLUDE_DIRS - the mediasteamer2 include directory -# MEDIASTREAMER2_LIBRARIES - The library needed to use mediasteamer2 -# MEDIASTREAMER2_PLUGINS_LOCATION - The location of the mediastreamer2 plugins - -if(TARGET mediastreamer2) - - set(MEDIASTREAMER2_LIBRARIES mediastreamer2) - get_target_property(MEDIASTREAMER2_INCLUDE_DIRS mediastreamer2 INTERFACE_INCLUDE_DIRECTORIES) - define_property(TARGET PROPERTY "MS2_PLUGINS" BRIEF_DOCS "Stores the location of mediastreamer2 plugins" FULL_DOCS "Stores the location of mediastreamer2 plugins") - get_target_property(MEDIASTREAMER2_PLUGINS_LOCATION mediastreamer2 MS2_PLUGINS) - - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Mediastreamer2 - DEFAULT_MSG - MEDIASTREAMER2_INCLUDE_DIRS MEDIASTREAMER2_LIBRARIES - ) - - mark_as_advanced(MEDIASTREAMER2_INCLUDE_DIRS MEDIASTREAMER2_LIBRARIES) - -endif() diff --git a/cmake/FindNotify.cmake b/cmake/FindNotify.cmake deleted file mode 100644 index e136141953..0000000000 --- a/cmake/FindNotify.cmake +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################ -# FindNotify.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -############################################################################ -# -# - Find the notify include file and library -# -# NOTIFY_FOUND - system has libnotify -# NOTIFY_INCLUDE_DIRS - the libnotify include directory -# NOTIFY_LIBRARIES - The libraries needed to use libnotify - -set(_NOTIFY_ROOT_PATHS - ${CMAKE_INSTALL_PREFIX} -) - -find_path(NOTIFY_INCLUDE_DIRS - NAMES libnotify/notify.h - HINTS _NOTIFY_ROOT_PATHS - PATH_SUFFIXES include -) - -if(NOTIFY_INCLUDE_DIRS) - set(HAVE_LIBNOTIFY_NOTIFY_H 1) -endif() - -find_library(NOTIFY_LIBRARIES - NAMES notify - HINTS ${_NOTIFY_ROOT_PATHS} - PATH_SUFFIXES bin lib -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Notify - DEFAULT_MSG - NOTIFY_INCLUDE_DIRS NOTIFY_LIBRARIES HAVE_LIBNOTIFY_NOTIFY_H -) - -mark_as_advanced(NOTIFY_INCLUDE_DIRS NOTIFY_LIBRARIES HAVE_LIBNOTIFY_NOTIFY_H) diff --git a/cmake/FindOpenLDAP.cmake b/cmake/FindOpenLDAP.cmake index 8fc1b00633..df9d753dcd 100644 --- a/cmake/FindOpenLDAP.cmake +++ b/cmake/FindOpenLDAP.cmake @@ -18,66 +18,123 @@ # ############################################################################ # -# - Find the OpenLDAP include file and library +# Find the openldap library. # -# OPENLDAP_FOUND - system has OpenLDAP -# OPENLDAP_INCLUDE_DIRS - the OpenLDAP include directory -# OPENLDAP_LIBRARIES - The libraries needed to use OpenLDAP +# Targets +# ^^^^^^^ +# +# The following targets may be defined: +# +# ldap - If the ldap library has been found +# lber - If the lber library has been found +# +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# OpenLDAP_FOUND - The ldap library has been found +# OpenLDAP_TARGETS - The list of the names of the CMake targets for the openldap libraries +# OpenLDAP_TARGET - The name of the CMake target for the ldap library +# OpenLDAP_lber_TARGET - The name of the CMake target for the lber library + + +include(FindPackageHandleStandardArgs) + +set(_OpenLDAP_REQUIRED_VARS OpenLDAP_TARGETS OpenLDAP_TARGET) +set(_OpenLDAP_CACHE_VARS ${_OpenLDAP_REQUIRED_VARS}) if(TARGET ldap) - set(OPENLDAP_LIBRARIES ldap) - get_target_property(OPENLDAP_INCLUDE_DIRS ldap INTERFACE_INCLUDE_DIRECTORIES) + set(OpenLDAP_TARGET ldap) + set(OpenLDAP_TARGETS ldap) + if(TARGET lber) + set(OpenLDAP_lber_TARGET lber) + list(APPEND OpenLDAP_TARGETS lber) + list(APPEND _OpenLDAP_CACHE_VARS OpenLDAP_lber_TARGET) + endif() else() - #Note : There are double find* because of priority given to the HINTS first. The second call will keep the result if there is one. - #INCLUDES - find_path(OPENLDAP_INCLUDE_DIRS + # Note : There are double find* because of priority given to the HINTS first. The second call will keep the result if there is one. + + find_path(_OpenLDAP_INCLUDE_DIRS NAMES ldap.h - PATH_SUFFIXES include/openldap HINTS "${CMAKE_INSTALL_PREFIX}" + PATH_SUFFIXES include/openldap NO_DEFAULT_PATH ) - find_path(OPENLDAP_INCLUDE_DIRS + find_path(_OpenLDAP_INCLUDE_DIRS NAMES ldap.h - PATH_SUFFIXES include/openldap HINTS "${CMAKE_INSTALL_PREFIX}" + PATH_SUFFIXES include/openldap ) - #LDAP - find_library(LDAP_LIB + find_library(_OpenLDAP_LIBRARY NAMES ldap libldap HINTS "${CMAKE_INSTALL_PREFIX}" PATH_SUFFIXES lib NO_DEFAULT_PATH ) - find_library(LDAP_LIB + find_library(_OpenLDAP_LIBRARY NAMES ldap libldap HINTS "${CMAKE_INSTALL_PREFIX}" PATH_SUFFIXES lib ) - #LBER - find_library(LBER_LIB + find_library(_OpenLDAP_lber_LIBRARY NAMES lber liblber HINTS "${CMAKE_INSTALL_PREFIX}" PATH_SUFFIXES lib NO_DEFAULT_PATH ) - find_library(LBER_LIB + find_library(_OpenLDAP_lber_LIBRARY NAMES lber liblber HINTS "${CMAKE_INSTALL_PREFIX}" PATH_SUFFIXES lib ) - set(OPENLDAP_LIBRARIES ${LDAP_LIB} ${LBER_LIB}) + + if(_OpenLDAP_INCLUDE_DIRS AND _OpenLDAP_LIBRARY) + add_library(ldap UNKNOWN IMPORTED) + if(WIN32) + set_target_properties(ldap PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_OpenLDAP_INCLUDE_DIRS}" + IMPORTED_IMPLIB "${_OpenLDAP_LIBRARY}" + ) + else() + set_target_properties(ldap PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_OpenLDAP_INCLUDE_DIRS}" + IMPORTED_LOCATION "${_OpenLDAP_LIBRARY}" + ) + endif() + set(OpenLDAP_TARGET ldap) + set(OpenLDAP_TARGETS ldap) + + if(_OpenLDAP_lber_LIBRARY) + add_library(lber UNKNOWN IMPORTED) + if(WIN32) + set_target_properties(lber PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_OpenLDAP_INCLUDE_DIRS}" + IMPORTED_IMPLIB "${_OpenLDAP_lber_LIBRARY}" + ) + else() + set_target_properties(lber PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_OpenLDAP_INCLUDE_DIRS}" + IMPORTED_LOCATION "${_OpenLDAP_lber_LIBRARY}" + ) + endif() + set(OpenLDAP_lber_TARGET lber) + set(OpenLDAP_lber_FOUND TRUE) + list(APPEND OpenLDAP_TARGETS lber) + list(APPEND _OpenLDAP_CACHE_VARS OpenLDAP_lber_TARGET) + endif() + endif() endif() -include(FindPackageHandleStandardArgs) find_package_handle_standard_args(OpenLDAP - DEFAULT_MSG - OPENLDAP_INCLUDE_DIRS OPENLDAP_LIBRARIES + REQUIRED_VARS ${_OpenLDAP_REQUIRED_VARS} + HANDLE_COMPONENTS ) - -mark_as_advanced(OPENLDAP_INCLUDE_DIRS OPENLDAP_LIBRARIES) +mark_as_advanced(${_OpenLDAP_CACHE_VARS}) diff --git a/cmake/FindOrtp.cmake b/cmake/FindOrtp.cmake deleted file mode 100644 index 13121fb4a3..0000000000 --- a/cmake/FindOrtp.cmake +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# FindOrtp.cmake -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the ortp include files and library -# -# ORTP_FOUND - system has lib ortp -# ORTP_INCLUDE_DIRS - the ortp include directory -# ORTP_LIBRARIES - The library needed to use ortp - -if(TARGET ortp) - - set(ORTP_LIBRARIES ortp) - get_target_property(ORTP_INCLUDE_DIRS ortp INTERFACE_INCLUDE_DIRECTORIES) - - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Ortp - DEFAULT_MSG - ORTP_INCLUDE_DIRS ORTP_LIBRARIES - ) - - mark_as_advanced(ORTP_INCLUDE_DIRS ORTP_LIBRARIES) - -endif() diff --git a/cmake/FindSASL.cmake b/cmake/FindSASL.cmake deleted file mode 100644 index e6dca85c55..0000000000 --- a/cmake/FindSASL.cmake +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# Copyright (c) 2021 Belledonne Communications SARL. -# -# This file is part of liblinphone. -# -# 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 3 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, see <http://www.gnu.org/licenses/>. -# -############################################################################ -# -# - Find the Cyrus SASL include file and library -# -# SASL_FOUND - system has OpenLDAP -# SASL_INCLUDE_DIRS - the OpenLDAP include directory -# SASL_LIBRARIES - The libraries needed to use OpenLDAP - -find_path(SASL_INCLUDE_DIRS - NAMES sasl/sasl.h - HINTS "${CMAKE_INSTALL_PREFIX}" - PATH_SUFFIXES include -) - -find_library(SASL_LIBRARIES - NAMES sasl2 - HINTS "${CMAKE_INSTALL_PREFIX}" - PATH_SUFFIXES lib -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SASL - DEFAULT_MSG - SASL_INCLUDE_DIRS SASL_LIBRARIES -) - -mark_as_advanced(SASL_INCLUDE_DIRS SASL_LIBRARIES) diff --git a/cmake/FindSoci.cmake b/cmake/FindSoci.cmake index d12b059064..6cd2bc3612 100644 --- a/cmake/FindSoci.cmake +++ b/cmake/FindSoci.cmake @@ -1,111 +1,139 @@ -############################################################################### -# CMake module to search for SOCI library +############################################################################ +# FindSoci.cmake +# Copyright (C) 2023 Belledonne Communications, Grenoble France # -# WARNING: This module is experimental work in progress. +############################################################################ # -# This module defines: -# SOCI_INCLUDE_DIRS = include dirs to be used when using the soci library -# SOCI_LIBRARIES = full path to the soci library -# SOCI_VERSION = the soci version found (not yet. soci does not provide that info.) -# SOCI_FOUND = true if soci was found +# 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. # -# For each component you specify in find_package(), the following variables are set. +# 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. # -# SOCI_${COMPONENT}_PLUGIN = full path to the soci plugin -# SOCI_${COMPONENT}_FOUND +# 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. # -# Copyright (c) 2011 Michael Jansen <info@michael-jansen.biz> +############################################################################ # -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# Find the soci library. # -############################################################################### +# Targets +# ^^^^^^^ # -### Global Configuration Section +# The following targets may be defined: # -SET(_SOCI_ALL_PLUGINS mysql sqlite3) +# soci - If the soci library has been found +# +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# Soci_FOUND - The soci library has been found +# Soci_TARGET - The name of the CMake target for the soci library +# +# This module may set the following variable: +# +# Soci_mysql_TARGET - The name of the CMake target for the mysql soci plugin +# Soci_odbc_TARGET - The name of the CMake target for the obdc soci plugin +# Soci_postgresql_TARGET - The name of the CMake target for the postgresql soci plugin +# Soci_sqlite3_TARGET - The name of the CMake target for the sqlite3 soci plugin -SET(_SOCI_REQUIRED_VARS SOCI_INCLUDE_DIRS SOCI_LIBRARIES) -SET(_SOCI_VERSION "_4_0") + +include(FindPackageHandleStandardArgs) + +set(_Soci_ALL_PLUGINS mysql odbc postgresql sqlite3) + +set(_Soci_REQUIRED_VARS Soci_TARGET) +set(_Soci_CACHE_VARS ${_Soci_REQUIRED_VARS}) +set(_Soci_VERSION "_4_0") if(TARGET soci_core OR TARGET soci_core_static) if(TARGET soci_core) - set(SOCI_CORE_TARGET soci_core) + set(Soci_TARGET soci_core) else() - set(SOCI_CORE_TARGET soci_core_static) + set(Soci_TARGET soci_core_static) endif() - set(SOCI_LIBRARIES ${SOCI_CORE_TARGET}) - get_target_property(SOCI_INCLUDE_DIRS ${SOCI_CORE_TARGET} INTERFACE_INCLUDE_DIRECTORIES) if(TARGET soci_sqlite3 OR TARGET soci_sqlite3_static) - if(TARGET soci_sqlite3) - set(SOCI_SQLITE3_TARGET soci_sqlite3) - else() - set(SOCI_SQLITE3_TARGET soci_sqlite3_static) - endif() - set(SOCI_sqlite3_PLUGIN ${SOCI_SQLITE3_TARGET}) + list(APPEND _Soci_REQUIRED_VARS Soci_sqlite3_TARGET) + if(TARGET soci_sqlite3) + set(Soci_sqlite3_TARGET soci_sqlite3) + else() + set(Soci_sqlite3_TARGET soci_sqlite3_static) + endif() + set(Soci_sqlite3_FOUND TRUE) endif() else() - # - ### FIRST STEP: Find the soci headers. - # - FIND_PATH(SOCI_INCLUDE_DIRS soci/soci.h - DOC "Soci (http://soci.sourceforge.net) include directory") - MARK_AS_ADVANCED(SOCI_INCLUDE_DIRS) - - # - ### SECOND STEP: Find the soci core library. Respect LIB_SUFFIX - # - FIND_LIBRARY(SOCI_LIBRARIES - NAMES soci_core soci_core${_SOCI_VERSION} libsoci_core libsoci_core${_SOCI_VERSION} - PATH_SUFFIXES Frameworks lib lib64) - MARK_AS_ADVANCED(SOCI_LIBRARIES) - - GET_FILENAME_COMPONENT(SOCI_LIBRARY_DIR ${SOCI_LIBRARIES} PATH) - MARK_AS_ADVANCED(SOCI_LIBRARY_DIR) - - # - ### THIRD STEP: Find all installed plugins if the library was found - # - IF(SOCI_INCLUDE_DIRS AND SOCI_LIBRARIES) - - MESSAGE(STATUS "Soci found: Looking for plugins") - FOREACH(plugin IN LISTS _SOCI_ALL_PLUGINS) - - FIND_LIBRARY( - SOCI_${plugin}_PLUGIN - NAMES soci_${plugin} soci_${plugin}${_SOCI_VERSION} libsoci_${plugin} libsoci_${plugin}${_SOCI_VERSION} - PATH_SUFFIXES Frameworks lib lib64) - MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN) - - IF(SOCI_${plugin}_PLUGIN) - MESSAGE(STATUS " * Plugin ${plugin} found ${SOCI_${plugin}_PLUGIN}.") - SET(SOCI_${plugin}_FOUND True) - ELSE() - MESSAGE(STATUS " * Plugin ${plugin} not found.") - SET(SOCI_${plugin}_FOUND False) - ENDIF() - - ENDFOREACH() - - # - ### FOURTH CHECK: Check if the required components were all found - # - FOREACH(component ${Soci_FIND_COMPONENTS}) - IF(NOT SOCI_${component}_FOUND) - MESSAGE(SEND_ERROR "Required component ${component} not found. It seems that Soci was built without support of ${component}, consider rebuilding it.") - ENDIF() - ENDFOREACH() - - ENDIF() + find_path(_Soci_INCLUDE_DIRS NAMES soci/soci.h) + + find_library(_Soci_LIBRARY + NAMES soci_core soci_core${_Soci_VERSION} libsoci_core libsoci_core${_Soci_VERSION} + PATH_SUFFIXES Frameworks lib lib64 + ) + + if(_Soci_INCLUDE_DIRS AND _Soci_LIBRARY) + if(NOT TARGET soci) + add_library(soci UNKNOWN IMPORTED) + if(WIN32) + set_target_properties(soci PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_Soci_INCLUDE_DIRS}" + IMPORTED_IMPLIB "${_Soci_LIBRARY}" + ) + else() + set_target_properties(soci PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_Soci_INCLUDE_DIRS}" + IMPORTED_LOCATION "${_Soci_LIBRARY}" + ) + endif() + endif() + set(Soci_TARGET soci) + + message(STATUS "Soci found: Looking for plugins") + foreach(_Soci_PLUGIN IN LISTS _Soci_ALL_PLUGINS) + find_library(_Soci_${_Soci_PLUGIN}_PLUGIN + NAMES soci_${_Soci_PLUGIN} soci_${_Soci_PLUGIN}${_Soci_VERSION} libsoci_${_Soci_PLUGIN} libsoci_${_Soci_PLUGIN}${_Soci_VERSION} + PATH_SUFFIXES Frameworks lib lib64 + ) + if(_Soci_${_Soci_PLUGIN}_PLUGIN) + message(STATUS " * Plugin ${_Soci_PLUGIN} found ${_Soci_${_Soci_PLUGIN}_PLUGIN}.") + if(NOT TARGET soci_${_Soci_PLUGIN}) + add_library(soci_${_Soci_PLUGIN} UNKNOWN IMPORTED) + if(WIN32) + set_target_properties(soci_${_Soci_PLUGIN} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_Soci_INCLUDE_DIRS}" + IMPORTED_IMPLIB "${_Soci_${_Soci_PLUGIN}_PLUGIN}" + ) + else() + set_target_properties(soci_${_Soci_PLUGIN} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_Soci_INCLUDE_DIRS}" + IMPORTED_LOCATION "${_Soci_${_Soci_PLUGIN}_PLUGIN}" + ) + endif() + endif() + set(Soci_${_Soci_PLUGIN}_FOUND TRUE) + set(Soci_${_Soci_PLUGIN}_TARGET soci_${_Soci_PLUGIN}) + list(APPEND _Soci_CACHE_VARS Soci_${_Soci_PLUGIN}_TARGET) + else() + message(STATUS " * Plugin ${_Soci_PLUGIN} not found.") + endif() + endforeach() + + endif() endif() -# -### ADHERE TO STANDARDS -# -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Soci DEFAULT_MSG ${_SOCI_REQUIRED_VARS}) +find_package_handle_standard_args(Soci + REQUIRED_VARS ${_Soci_REQUIRED_VARS} + HANDLE_COMPONENTS +) +mark_as_advanced(${_Soci_CACHE_VARS}) diff --git a/cmake/FindSqlite3.cmake b/cmake/FindSqlite3.cmake deleted file mode 100644 index e329c8faa1..0000000000 --- a/cmake/FindSqlite3.cmake +++ /dev/null @@ -1,67 +0,0 @@ -############################################################################ -# FindSqlite3.cmake -# Copyright (C) 2014-2023 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. -# -############################################################################ -# -# - 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 - -if(TARGET sqlite3) - - set(SQLITE3_LIBRARIES sqlite3) - get_target_property(SQLITE3_INCLUDE_DIRS sqlite3 INTERFACE_INCLUDE_DIRECTORIES) - set(HAVE_SQLITE3_H 1) - -else() - - if(APPLE AND NOT IOS) - set(SQLITE3_HINTS "/usr") - endif() - if(SQLITE3_HINTS) - set(SQLITE3_LIBRARIES_HINTS "${SQLITE3_HINTS}/lib") - endif() - - find_path(SQLITE3_INCLUDE_DIRS - NAMES sqlite3.h - HINTS "${SQLITE3_HINTS}" - PATH_SUFFIXES include - ) - - if(SQLITE3_INCLUDE_DIRS) - set(HAVE_SQLITE3_H 1) - endif() - - find_library(SQLITE3_LIBRARIES - NAMES sqlite3 - HINTS "${SQLITE3_LIBRARIES_HINTS}" - ) - -endif() - -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) diff --git a/cmake/FindSupport.cmake b/cmake/FindSupport.cmake deleted file mode 100644 index d00a52f388..0000000000 --- a/cmake/FindSupport.cmake +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################ -# FindSupport.cmake -# Copyright (C) 2017-2023 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. -# -############################################################################ -# -# - Find the Android support include file and library -# -# SUPPORT_FOUND - system has libsupport -# SUPPORT_LIBRARIES - The libraries needed to use libsupport - -if(TARGET support) - - set(SUPPORT_LIBRARIES support) - -else() - - find_library(SUPPORT_LIBRARIES - NAMES support - ) - -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Support - DEFAULT_MSG - SUPPORT_LIBRARIES -) - -mark_as_advanced(SUPPORT_LIBRARIES) diff --git a/cmake/FindTunnel.cmake b/cmake/FindTunnel.cmake deleted file mode 100644 index 216409aa98..0000000000 --- a/cmake/FindTunnel.cmake +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# FindTunnel.cmake -# Copyright (C) 2023 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. -# -############################################################################ -# -# - Find the tunnel include files and library -# -# TUNNEL_FOUND - system has lib tunnel -# TUNNEL_INCLUDE_DIRS - the tunnel include directory -# TUNNEL_LIBRARIES - The library needed to use tunnel - -if(TARGET tunnel) - - set(TUNNEL_LIBRARIES tunnel) - get_target_property(TUNNEL_INCLUDE_DIRS tunnel INTERFACE_INCLUDE_DIRECTORIES) - - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Tunnel - DEFAULT_MSG - TUNNEL_INCLUDE_DIRS TUNNEL_LIBRARIES - ) - - mark_as_advanced(TUNNEL_INCLUDE_DIRS TUNNEL_LIBRARIES) - -endif() diff --git a/cmake/FindTurboJpeg.cmake b/cmake/FindTurboJpeg.cmake index 74542ac08c..6de8f5d0e4 100644 --- a/cmake/FindTurboJpeg.cmake +++ b/cmake/FindTurboJpeg.cmake @@ -20,52 +20,77 @@ # ############################################################################ # -# - Find the turbojpeg include file and library +# Find the turbojpeg library. # -# TURBOJPEG_FOUND - system has turbojpeg -# TURBOJPEG_INCLUDE_DIRS - the turbojpeg include directory -# TURBOJPEG_LIBRARIES - The libraries needed to use turbojpeg +# Targets +# ^^^^^^^ +# +# The following targets may be defined: +# +# turbojpeg - If the turbojpeg library has been found +# +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# TurboJpeg_FOUND - The turbojpeg library has been found +# TurboJpeg_TARGET - The name of the CMake target for the turbojpeg library + + +include(FindPackageHandleStandardArgs) + +set(_TurboJpeg_REQUIRED_VARS TurboJpeg_TARGET) +set(_TurboJpeg_CACHE_VARS ${_TurboJpeg_REQUIRED_VARS}) if(TARGET turbojpeg) - set(TURBOJPEG_LIBRARIES turbojpeg) - get_target_property(TURBOJPEG_INCLUDE_DIRS turbojpeg INTERFACE_INCLUDE_DIRECTORIES) - set(HAVE_TURBOJPEG_H 1) + set(TurboJpeg_TARGET turbojpeg) else() - find_path(TURBOJPEG_INCLUDE_DIRS + find_path(_TurboJpeg_INCLUDE_DIRS NAMES turbojpeg.h PATH_SUFFIXES include ) - if(TURBOJPEG_INCLUDE_DIRS) - set(HAVE_TURBOJPEG_H 1) - endif() - find_library(TURBOJPEG_LIBRARIES + find_library(_TurboJpeg_LIBRARY NAMES turbojpeg turbojpeg-static PATH_SUFFIXES bin lib ) - if(TURBOJPEG_INCLUDE_DIRS AND TURBOJPEG_LIBRARIES AND NOT MSVC) - include(CheckCSourceCompiles) - include(CMakePushCheckState) + if(_TurboJpeg_INCLUDE_DIRS AND _TurboJpeg_LIBRARY) + add_library(turbojpeg UNKNOWN IMPORTED) + if(WIN32) + set_target_properties(turbojpeg PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_TurboJpeg_INCLUDE_DIRS}" + IMPORTED_IMPLIB "${_TurboJpeg_LIBRARY}" + ) + else() + set_target_properties(turbojpeg PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_TurboJpeg_INCLUDE_DIRS}" + IMPORTED_LOCATION "${_TurboJpeg_LIBRARY}" + ) + endif() - cmake_push_check_state(RESET) - list(APPEND CMAKE_REQUIRED_INCLUDES ${TURBOJPEG_INCLUDE_DIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES ${TURBOJPEG_LIBRARIES}) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") - if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error=unused-command-line-argument") - endif() + if(NOT MSVC) + include(CMakePushCheckState) + cmake_push_check_state(RESET) + list(APPEND CMAKE_REQUIRED_INCLUDES ${_TurboJpeg_INCLUDE_DIRS}) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${_TurboJpeg_LIBRARIES}) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") + if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error=unused-command-line-argument") + endif() + endif() + + set(TurboJpeg_TARGET turbojpeg) endif() endif() -include(FindPackageHandleStandardArgs) find_package_handle_standard_args(TurboJpeg - DEFAULT_MSG - TURBOJPEG_INCLUDE_DIRS TURBOJPEG_LIBRARIES + REQUIRED_VARS ${_TurboJpeg_REQUIRED_VARS} ) - -mark_as_advanced(TURBOJPEG_INCLUDE_DIRS TURBOJPEG_LIBRARIES) +mark_as_advanced(${_TurboJpeg_CACHE_VARS}) diff --git a/cmake/FindXML2.cmake b/cmake/FindXML2.cmake deleted file mode 100644 index 82c86da22e..0000000000 --- a/cmake/FindXML2.cmake +++ /dev/null @@ -1,67 +0,0 @@ -############################################################################ -# FindXML2.cmake -# Copyright (C) 2015-2023 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. -# -############################################################################ -# -# - 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 - -if(TARGET xml2) - - set(XML2_LIBRARIES xml2) - get_target_property(XML2_INCLUDE_DIRS xml2 INTERFACE_INCLUDE_DIRECTORIES) - set(HAVE_LIBXML_XMLREADER_H 1) - -else() - - if(APPLE AND NOT IOS) - set(XML2_HINTS "/usr") - endif() - if(XML2_HINTS) - set(XML2_LIBRARIES_HINTS "${XML2_HINTS}/lib") - endif() - - find_path(XML2_INCLUDE_DIRS - NAMES libxml/xmlreader.h - HINTS "${XML2_HINTS}" - PATH_SUFFIXES include/libxml2 - ) - - if(XML2_INCLUDE_DIRS) - set(HAVE_LIBXML_XMLREADER_H 1) - endif() - - find_library(XML2_LIBRARIES - NAMES xml2 - HINTS "${XML2_LIBRARIES_HINTS}" - ) - -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(XML2 - DEFAULT_MSG - XML2_INCLUDE_DIRS XML2_LIBRARIES -) - -mark_as_advanced(XML2_INCLUDE_DIRS XML2_LIBRARIES) diff --git a/cmake/FindZXing.cmake b/cmake/FindZXing.cmake index 6ae48ba452..3c2cffde1f 100644 --- a/cmake/FindZXing.cmake +++ b/cmake/FindZXing.cmake @@ -1,5 +1,5 @@ ############################################################################ -# FindZxing.cmake +# FindZXing.cmake # Copyright (C) 2018-2023 Belledonne Communications, Grenoble France # ############################################################################ @@ -20,21 +20,42 @@ # ############################################################################ # -# - Find the zxing include file and library +# Find the XZing library. # -# ZXING_FOUND - system has zxing -# ZXING_INCLUDE_DIRS - the zxing include directory -# ZXING_LIBRARIES - The libraries needed to use zxing +# Targets +# ^^^^^^^ +# +# The following targets may be defined: +# +# ZXing - If the ZXing library has been found +# +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# ZXing_FOUND - The ZXing library has been found +# ZXing_TARGET - The name of the CMake target for the ZXing library +# +# This module may set the following variable: +# +# ZXing_USE_BUILD_INTERFACE - If the ZXing library is used from its build directory + + +include(FindPackageHandleStandardArgs) + +set(_ZXing_REQUIRED_VARS ZXing_TARGET) +set(_ZXing_CACHE_VARS ${_ZXing_REQUIRED_VARS}) if(TARGET ZXing) - set(ZXING_LIBRARIES ZXing) - get_target_property(ZXING_INCLUDE_DIRS ZXing INTERFACE_INCLUDE_DIRECTORIES) - set(ZXING_USE_BUILD_INTERFACE ON) + set(ZXing_TARGET ZXing) + set(ZXing_USE_BUILD_INTERFACE TRUE) else() - find_path(ZXING_INCLUDE_DIRS + find_path(_ZXing_INCLUDE_DIRS NAMES ZXing/BarcodeFormat.h ZXing/BitHacks.h @@ -48,18 +69,31 @@ else() PATH_SUFFIXES include ) - find_library(ZXING_LIBRARIES + find_library(_ZXing_LIBRARY NAMES ZXing libZXing PATH_SUFFIXES Frameworks bin lib lib64 ) + if(_ZXing_INCLUDE_DIRS AND _ZXing_LIBRARY) + add_library(ZXing UNKNOWN IMPORTED) + if(WIN32) + set_target_properties(ZXing PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_ZXing_INCLUDE_DIRS}" + IMPORTED_IMPLIB "${_ZXing_LIBRARY}" + ) + else() + set_target_properties(ZXing PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_ZXing_INCLUDE_DIRS}" + IMPORTED_LOCATION "${_ZXing_LIBRARY}" + ) + endif() + + set(ZXing_TARGET ZXing) + endif() + endif() -include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ZXing - DEFAULT_MSG - ZXING_INCLUDE_DIRS ZXING_LIBRARIES + REQUIRED_VARS ${_ZXing_REQUIRED_VARS} ) - -mark_as_advanced(ZXING_INCLUDE_DIRS ZXING_LIBRARIES) - +mark_as_advanced(${_ZXing_CACHE_VARS}) diff --git a/cmake/LibLinphoneConfig.cmake.in b/cmake/LibLinphoneConfig.cmake.in new file mode 100644 index 0000000000..9c3d80fecb --- /dev/null +++ b/cmake/LibLinphoneConfig.cmake.in @@ -0,0 +1,97 @@ +############################################################################ +# LibLinphoneConfig.cmake +# Copyright (C) 2015-2023 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 liblinphone package. +# +# Targets +# ^^^^^^^ +# +# The following targets are defined: +# liblinphone - The liblinphone library target +# +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This config file will set the following variables in your project: +# +# LibLinphone_FOUND - The liblinphone library has been found +# LibLinphone_TARGET - The name of the CMake target for the liblinphone library +# LibLinphone_PLUGINS_DIR - The directory where to install liblinphone plugins + + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/LibLinphoneTargets.cmake") + +set(LibLinphone_TARGET liblinphone) +set_and_check(LibLinphone_PLUGINS_DIR "@PACKAGE_LIBLINPHONE_PLUGINS_DIR@") + +# We must propagate the public dependencies and the private dependencies for static build +include(CMakeFindDependencyMacro) +find_dependency(BelleSIP) +find_dependency(Mediastreamer2) +find_dependency(Ortp) +if(@SQLite3_FOUND@) + find_dependency(SQLite3) +endif() +if(@LibXml2_FOUND@) + find_dependency(LibXml2) +endif() +if(@Lime_FOUND@) + find_dependency(Lime) +endif() +if(@BUILD_SHARED_LIBS@) +else() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + if(@BelCard_FOUND@) + find_dependency(BelCard) + endif() + find_dependency(BCToolbox) + find_dependency(Belr) + if(@XercesC_FOUND@) + find_dependency(XercesC) + endif() + if(@Soci_FOUND@) + find_dependency(Soci) + endif() + if(@ZLIB_FOUND@) + find_dependency(ZLIB) + endif() + if(@Tunnel_FOUND@) + find_dependency(Tunnel) + endif() + if(@BZRTP_FOUND@) + find_dependency(BZRTP) + endif() + if(@OpenLDAP_FOUND@) + find_dependency(OpenLDAP) + endif() + if(@ZXing_FOUND@) + find_dependency(ZXing) + endif() + if(@TurboJpeg_FOUND@) + find_dependency(TurboJpeg) + endif() +endif() + +check_required_components(LibLinphone) diff --git a/cmake/LinphoneConfig.cmake.in b/cmake/LinphoneConfig.cmake.in deleted file mode 100644 index 12d5ceb2a4..0000000000 --- a/cmake/LinphoneConfig.cmake.in +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################ -# LinphoneConfig.cmake -# Copyright (C) 2015-2023 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 belle-sip package. -# It defines the following variables: -# -# LINPHONE_FOUND - system has linphone -# LINPHONE_INCLUDE_DIRS - the linphone include directory -# LINPHONE_CPPFLAGS - The compilation flags needed to use linphone -# LINPHONE_LDFLAGS - The linking flags needed to use linphone - - -@PACKAGE_INIT@ - -include("${CMAKE_CURRENT_LIST_DIR}/LinphoneTargets.cmake") - -set(LINPHONE_TARGETNAME linphone) - - -if(@BUILD_SHARED_LIBS@) - set(LINPHONE_LIBRARIES ${LINPHONE_TARGETNAME}) -else() - get_target_property(LINPHONE_LIBRARIES ${LINPHONE_TARGETNAME} LOCATION) - get_target_property(LINPHONE_LINK_LIBRARIES ${LINPHONE_TARGETNAME} INTERFACE_LINK_LIBRARIES) - if(LINPHONE_LINK_LIBRARIES) - list(APPEND LINPHONE_LIBRARIES ${LINPHONE_LINK_LIBRARIES}) - endif() -endif() -get_target_property(LINPHONE_INCLUDE_DIRS ${LINPHONE_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES) - - -set_target_properties(${LINPHONE_TARGETNAME} PROPERTIES INTERFACE_LINK_LIBRARIES "@INTERFACE_LIBS@") - -set(LINPHONE_CPPFLAGS @LINPHONE_CPPFLAGS@) -set(LINPHONE_LDFLAGS "@LINPHONE_LDFLAGS@") -set(LINPHONE_FOUND 1) diff --git a/config.h.cmake b/config.h.cmake index 6bf170bc7f..8eea083695 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -51,8 +51,6 @@ #define MEDIASTREAMER2_LOCAL_PLUGINS_LOCATION "${CMAKE_BINARY_DIR}/lib/mediastreamer2/plugins" #define LIBLINPHONE_LOCAL_PLUGINS_LOCATION "${CMAKE_BINARY_DIR}/lib/liblinphone/plugins" -#cmakedefine BUILD_WIZARD -#cmakedefine HAVE_NOTIFY4 #cmakedefine HAVE_ZLIB 1 #cmakedefine HAVE_CU_GET_SUITE 1 #cmakedefine HAVE_CU_CURSES 1 diff --git a/console/CMakeLists.txt b/console/CMakeLists.txt index b7ee75db41..c086bc17c1 100644 --- a/console/CMakeLists.txt +++ b/console/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # CMakeLists.txt -# Copyright (c) 2010-2022 Belledonne Communications SARL. +# Copyright (c) 2010-2023 Belledonne Communications SARL. # ############################################################################ # @@ -38,8 +38,7 @@ if(MSVC) endif() add_executable(linphonec ${LINPHONEC_SOURCE_FILES}) -target_link_libraries(linphonec ${LINPHONE_LIBS_FOR_TOOLS} bctoolbox ortp mediastreamer2 ${XSD_LIBRARIES}) -set_target_properties(linphonec PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") +target_link_libraries(linphonec PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Mediastreamer2_TARGET} ${Ortp_TARGET} ${BCToolbox_TARGET} ${XSD_LIBRARIES}) set_target_properties(linphonec PROPERTIES LINKER_LANGUAGE CXX) if(INTL_FOUND) @@ -48,15 +47,14 @@ endif() if(WIN32) add_executable(linphoned WIN32 ${LINPHONEC_SOURCE_FILES}) - target_link_libraries(linphoned ${LINPHONE_LIBS_FOR_TOOLS} bctoolbox ortp mediastreamer2 ${XSD_LIBRARIES}) + target_link_libraries(linphoned PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Mediastreamer2_TARGET} ${Ortp_TARGET} ${BCToolbox_TARGET} ${XSD_LIBRARIES}) if(INTL_FOUND) - target_link_libraries(linphoned ${INTL_LIBRARIES}) + target_link_libraries(linphoned PRIVATE ${INTL_LIBRARIES}) endif() endif() add_executable(linphonecsh ${LINPHONECSH_SOURCE_FILES}) -target_link_libraries(linphonecsh ${LINPHONE_LIBS_FOR_TOOLS} bctoolbox ortp) -set_target_properties(linphonecsh PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") +target_link_libraries(linphonecsh PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Ortp_TARGET} ${BCToolbox_TARGET}) set_target_properties(linphonecsh PROPERTIES LINKER_LANGUAGE CXX) set(INSTALL_TARGETS linphonec linphonecsh) diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index b1ea74b3d4..99574ab410 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -82,7 +82,6 @@ set(LINPHONE_SOURCE_FILES_CXX if(ENABLE_JAVA_WRAPPER) list(APPEND LINPHONE_SOURCE_FILES_CXX ${LINPHONE_JNI_SOURCES}) set_source_files_properties(${LINPHONE_JNI_SOURCES} PROPERTIES GENERATED TRUE) - set_source_files_properties(${LINPHONE_JNI_SOURCES} PROPERTIES INCLUDE_DIRECTORIES "${CPUFEATURES_INCLUDE_DIRS}") endif() set(LINPHONE_SOURCE_FILES_OBJC) @@ -109,7 +108,7 @@ else() list(APPEND LINPHONE_SOURCE_FILES_C linphone_tunnel_stubs.c) endif() -if(BELCARD_FOUND) +if(BelCard_FOUND) list(APPEND LINPHONE_SOURCE_FILES_CXX vcard.cc) list(APPEND LINPHONE_SOURCE_FILES_C carddav.c) else() @@ -134,19 +133,32 @@ bc_apply_compile_flags(LINPHONE_SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTI add_library(liblinphone-coreapi OBJECT ${LINPHONE_PRIVATE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX} ${LINPHONE_SOURCE_FILES_OBJC} ) -target_include_directories(liblinphone-coreapi PRIVATE - ${LINPHONE_INCLUDE_DIRS} - $<TARGET_PROPERTY:${BELLESIP_TARGETNAME},INTERFACE_INCLUDE_DIRECTORIES> - $<TARGET_PROPERTY:belr,INTERFACE_INCLUDE_DIRECTORIES> - $<TARGET_PROPERTY:mediastreamer2,INTERFACE_INCLUDE_DIRECTORIES> - $<TARGET_PROPERTY:ortp,INTERFACE_INCLUDE_DIRECTORIES> -) -if(BELCARD_FOUND) - target_include_directories(liblinphone-coreapi PRIVATE $<TARGET_PROPERTY:belcard,INTERFACE_INCLUDE_DIRECTORIES>) +target_include_directories(liblinphone-coreapi PRIVATE ${LINPHONE_INCLUDE_DIRS}) +target_link_libraries(liblinphone-coreapi PRIVATE ${BelleSIP_TARGET} ${Belr_TARGET} ${Mediastreamer2_TARGET} ${Ortp_TARGET}) +if(LibXml2_FOUND) + target_link_libraries(liblinphone-coreapi PRIVATE ${LibXml2_TARGET}) +endif() +if(XercesC_FOUND) + target_link_libraries(liblinphone-coreapi PRIVATE ${XercesC_TARGET}) +endif() +if(SQLite3_FOUND) + target_link_libraries(liblinphone-coreapi PRIVATE ${SQLite3_TARGET}) +endif() +if(Tunnel_FOUND) + target_link_libraries(liblinphone-coreapi PRIVATE ${Tunnel_TARGET}) +endif() +if(BelCard_FOUND) + target_link_libraries(liblinphone-coreapi PRIVATE ${BelCard_TARGET}) +endif() +if(ZLIB_FOUND) + target_link_libraries(liblinphone-coreapi PRIVATE ${ZLIB_TARGET}) +endif() +if(CpuFeatures_FOUND) + target_link_libraries(liblinphone-coreapi PRIVATE ${CpuFeatures_TARGET}) endif() add_dependencies(liblinphone-coreapi liblinphone-git-version) if(ENABLE_JAVA_WRAPPER) - add_dependencies(liblinphone-coreapi linphonej) + add_dependencies(liblinphone-coreapi linphonej) endif() if(BUILD_SHARED_LIBS) diff --git a/coreapi/help/examples/C/CMakeLists.txt b/coreapi/help/examples/C/CMakeLists.txt index 13fe9134f8..cc867111d8 100644 --- a/coreapi/help/examples/C/CMakeLists.txt +++ b/coreapi/help/examples/C/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # CMakeLists.txt -# Copyright (c) 2010-2022 Belledonne Communications SARL. +# Copyright (c) 2010-2023 Belledonne Communications SARL. # ############################################################################ # @@ -21,9 +21,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. ############################################################################ -if (ENABLE_TOOLS) +if(ENABLE_TOOLS) set(USE_BUNDLE ) - if (IOS) + if(IOS) set(USE_BUNDLE MACOSX_BUNDLE) endif() set(LINPHONE_C_EXAMPLES_SOURCE @@ -41,8 +41,7 @@ if (ENABLE_TOOLS) string(REPLACE ".c" "" EXECUTABLE_NAME ${EXECUTABLE}) bc_apply_compile_flags(${EXECUTABLE} STRICT_OPTIONS_CPP STRICT_OPTIONS_C) add_executable(${EXECUTABLE_NAME} ${USE_BUNDLE} ${EXECUTABLE}) - target_link_libraries(${EXECUTABLE_NAME} ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES} ${XSD_LIBRARIES}) - set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") + target_link_libraries(${EXECUTABLE_NAME} PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Mediastreamer2_TARGET} ${Ortp_TARGET} ${BCToolbox_TARGET} ${XSD_LIBRARIES}) if (NOT IOS) install(TARGETS ${EXECUTABLE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index 419b4cf647..946d80405c 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # CMakeLists.txt -# Copyright (c) 2010-2022 Belledonne Communications SARL. +# Copyright (c) 2010-2023 Belledonne Communications SARL. # ############################################################################ # @@ -126,16 +126,14 @@ bc_apply_compile_flags(DAEMON_PIPETEST_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OP bc_apply_compile_flags(DAEMON_SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC) add_executable(linphone-daemon ${DAEMON_SOURCE_FILES} ${DAEMON_SOURCE_FILES_OBJC}) target_include_directories(linphone-daemon PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${LINPHONE_INCLUDE_DIRS}) -target_link_libraries(linphone-daemon ${LINPHONE_LIBS_FOR_TOOLS} mediastreamer2 ortp bctoolbox belle-sip ${XSD_LIBRARIES}) -set_target_properties(linphone-daemon PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") +target_link_libraries(linphone-daemon PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${BelleSIP_TARGET} ${Mediastreamer2_TARGET} ${Ortp_TARGET} ${BCToolbox_TARGET} ${XSD_LIBRARIES}) set_target_properties(linphone-daemon PROPERTIES LINKER_LANGUAGE CXX) if(APPLE) - target_link_libraries(linphone-daemon "-framework AppKit") + target_link_libraries(linphone-daemon PRIVATE "-framework AppKit") endif() add_executable(linphone-daemon-pipetest ${DAEMON_PIPETEST_SOURCE_FILES}) -target_link_libraries(linphone-daemon-pipetest ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer2) -set_target_properties(linphone-daemon-pipetest PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") +target_link_libraries(linphone-daemon-pipetest PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Mediastreamer2_TARGET} ${Ortp_TARGET}) set_target_properties(linphone-daemon-pipetest PROPERTIES LINKER_LANGUAGE CXX) set(INSTALL_TARGETS linphone-daemon linphone-daemon-pipetest) diff --git a/plugins/example/CMakeLists.txt b/plugins/example/CMakeLists.txt index c69704299e..c0758713d4 100644 --- a/plugins/example/CMakeLists.txt +++ b/plugins/example/CMakeLists.txt @@ -35,8 +35,6 @@ set(PACKAGE_TARNAME "exampleplugin") set(PACKAGE_URL "") set(VERSION "${PACKAGE_VERSION}") -option(ENABLE_XML2 "Build with libxml2 support - for presence feature mainly" YES) - set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_EXTENSIONS NO) @@ -48,8 +46,8 @@ if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX) endif() find_library(LIBM NAMES m) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) -set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/config.h PROPERTIES GENERATED ON) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h") +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/config.h" PROPERTIES GENERATED ON) add_definitions(-DHAVE_CONFIG_H) set(SOURCE_FILES @@ -57,19 +55,12 @@ set(SOURCE_FILES ) set(INCLUDE_DIRS ) - -if(ENABLE_XML2) - list(APPEND INCLUDE_DIRS ${XML2_INCLUDE_DIRS}) -endif() - set(LIBS ) if(LIBM) list(APPEND LIBS ${LIBM}) endif() -set(PLUGINS_DIR "${LINPHONE_PACKAGE_PLUGINS_DIR}") - if(BUILD_SHARED_LIBS) if(NOT IOS) add_library(exampleplugin MODULE ${SOURCE_FILES}) @@ -87,7 +78,6 @@ target_include_directories(exampleplugin PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/> PRIVATE ${INCLUDE_DIRS} ) - target_link_libraries(exampleplugin PRIVATE liblinphone ${LIBS}) set_target_properties(exampleplugin PROPERTIES LINKER_LANGUAGE CXX) if(APPLE) @@ -115,9 +105,9 @@ if(MSVC) endif() install(TARGETS exampleplugin - RUNTIME DESTINATION ${PLUGINS_DIR} - LIBRARY DESTINATION ${PLUGINS_DIR} - ARCHIVE DESTINATION ${PLUGINS_DIR} + RUNTIME DESTINATION ${LIBLINPHONE_PLUGINS_DIR} + LIBRARY DESTINATION ${LIBLINPHONE_PLUGINS_DIR} + ARCHIVE DESTINATION ${LIBLINPHONE_PLUGINS_DIR} FRAMEWORK DESTINATION Frameworks PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 284566a1db..b4d7610b02 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,14 +22,13 @@ ############################################################################ set(LINK_LIBS - bctoolbox - ${BELLESIP_TARGETNAME} - belr + ${BCToolbox_TARGET} + ${Belr_TARGET} ) set(PUBLIC_LINK_LIBS - ortp - mediastreamer2 - belle-sip + ${Ortp_TARGET} + ${Mediastreamer2_TARGET} + ${BelleSIP_TARGET} ) #APPLE_LIBS is mandatory for apple compilation @@ -40,95 +39,69 @@ if(APPLE) endif() endif() -#interface_libs is used in export cmake config file -if(APPLE) - list(APPEND INTERFACE_LIBS ${APPLE_LIBS}) -endif() - -if(ENABLE_XML2) - list(APPEND LINK_LIBS ${XML2_LIBRARIES}) +if(LibXml2_FOUND) + list(APPEND PUBLIC_LINK_LIBS ${LibXml2_TARGET}) endif() -list(APPEND INTERFACE_LIBS ${LINK_LIBS} xsd) - if(HAVE_DLOPEN) list(APPEND LINK_LIBS dl) endif() -if (ENABLE_ADVANCED_IM) +if(ENABLE_ADVANCED_IM) list(APPEND LINK_LIBS ${XercesC_TARGET}) if (APPLE AND NOT IOS) list(APPEND APPLE_LIBS "-framework CoreServices") endif() endif() -if (LIME_FOUND) - list(APPEND PUBLIC_LINK_LIBS ${LIME_TARGETNAME}) +if(Lime_FOUND) + list(APPEND PUBLIC_LINK_LIBS ${Lime_TARGET}) endif () -if(ENABLE_LIME OR ENABLE_LIME_X3DH) - list(APPEND LINK_LIBS ${BZRTP_LIBRARIES}) +if(ENABLE_LIME_X3DH) + list(APPEND LINK_LIBS ${BZRTP_TARGET}) endif() if(ZLIB_FOUND) - list(APPEND INTERFACE_LIBS z) - if (ANDROID) - # Starting NDK r21, libz.a has issues: https://github.com/android/ndk/issues/1179 - list(APPEND LINK_LIBS z) - else() - list(APPEND LINK_LIBS ${ZLIB_LIBRARIES}) - endif() + list(APPEND LINK_LIBS ${ZLIB_TARGET}) endif() -if (ENABLE_DB_STORAGE) - if (SOCI_FOUND) - #take care of the order for static link - if(APPLE OR ANDROID) - list(APPEND INTERFACE_LIBS ${SOCI_sqlite3_PLUGIN}) - list(APPEND LINK_LIBS ${SOCI_sqlite3_PLUGIN}) - endif() - list(APPEND INTERFACE_LIBS soci) - list(APPEND LINK_LIBS ${SOCI_LIBRARIES}) +if(ENABLE_DB_STORAGE) + if(Soci_FOUND) + list(APPEND LINK_LIBS ${Soci_sqlite3_TARGET} ${Soci_TARGET}) endif() endif() -if(SQLITE3_FOUND) - list(APPEND INTERFACE_LIBS sqlite3) - list(APPEND PUBLIC_LINK_LIBS ${SQLITE3_LIBRARIES}) +if(SQLite3_FOUND) + list(APPEND PUBLIC_LINK_LIBS ${SQLite3_TARGET}) endif() -if(ICONV_FOUND) - list(APPEND INTERFACE_LIBS iconv) - list(APPEND LINK_LIBS ${ICONV_LIBRARIES}) +if(Iconv_FOUND) + list(APPEND LINK_LIBS Iconv::Iconv) endif() -if(ENABLE_TUNNEL) - list(APPEND LINK_LIBS ${TUNNEL_LIBRARIES}) - add_definitions(-DTUNNEL_ENABLED) +if(Tunnel_FOUND) + list(APPEND LINK_LIBS ${Tunnel_TARGET}) + add_definitions(-DTUNNEL_ENABLED) endif() if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") list(APPEND LINK_LIBS shlwapi) endif() if(INTL_FOUND) - list(APPEND INTERFACE_LIBS intl) list(APPEND LINK_LIBS ${INTL_LIBRARIES}) endif() -if(BELCARD_FOUND) - list(APPEND INTERFACE_LIBS belcard) - list(APPEND LINK_LIBS belcard) +if(BelCard_FOUND) + list(APPEND LINK_LIBS ${BelCard_TARGET}) endif() -if(OPENLDAP_FOUND) - list(APPEND LINK_LIBS ${OPENLDAP_LIBRARIES}) -endif() -#define log domain for this part of code -add_definitions(-DBCTBX_LOG_DOMAIN="liblinphone") -if(ENABLE_LDAP) +if(OpenLDAP_FOUND) + list(APPEND LINK_LIBS ${OpenLDAP_TARGETS}) add_definitions(-DBUILD_LDAP) endif() - -if(ZXING_FOUND) - list(APPEND LINK_LIBS ${ZXING_LIBRARIES}) +if(ZXing_FOUND) + list(APPEND LINK_LIBS ${ZXing_TARGET}) endif() - -if(TURBOJPEG_FOUND) - list(APPEND LINK_LIBS ${TURBOJPEG_LIBRARIES}) +if(TurboJpeg_FOUND) + list(APPEND LINK_LIBS ${TurboJpeg_TARGET}) endif() +#define log domain for this part of code +add_definitions(-DBCTBX_LOG_DOMAIN="liblinphone") + set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES account/account.h account/account-params.h @@ -630,15 +603,13 @@ elseif (UNIX) list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-linux.h) endif () -if(LIME_FOUND) +if(Lime_FOUND) list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES chat/encryption/lime-x3dh-encryption-engine.h) list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES chat/encryption/lime-x3dh-encryption-engine.cpp) endif() set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${LIBXSD_INCLUDE_DIRS} - ${SOCI_INCLUDE_DIRS} - ${SOCI_MYSQL_INCLUDES} ) set(LINPHONE_PRIVATE_HEADER_FILES) @@ -700,6 +671,7 @@ if(NOT ANDROID) # Do not version shared library on Android set_target_properties(liblinphone PROPERTIES SOVERSION ${LINPHONE_SO_VERSION}) endif() +set_target_properties(liblinphone PROPERTIES LIBLINPHONE_PLUGINS_DIR "${LIBLINPHONE_PLUGINS_DIR}") target_include_directories(liblinphone PUBLIC $<INSTALL_INTERFACE:include/> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/coreapi/> @@ -711,21 +683,20 @@ target_link_libraries(liblinphone PUBLIC ${PUBLIC_LINK_LIBS} PRIVATE ${LINK_LIBS} ) +if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + target_link_libraries(liblinphone PUBLIC "Ws2_32" "Iphlpapi" "user32") +endif() if(ENABLE_FLEXIAPI) - target_link_libraries(liblinphone PUBLIC ${JSONCPP_LIBRARIES}) + target_link_libraries(liblinphone PUBLIC ${JsonCPP_TARGET}) endif() if(APPLE) target_link_libraries(liblinphone PUBLIC ${APPLE_LIBS}) endif() -if(ICONV_FOUND) - if(APPLE) - # Prevent conflict between the system iconv.h header and the one from macports. - target_compile_options(liblinphone PRIVATE "-include" "${ICONV_INCLUDE_DIRS}/iconv.h") - else() - target_include_directories(liblinphone PRIVATE ${ICONV_INCLUDE_DIRS}) - endif() +if(Iconv_FOUND AND APPLE) + # Prevent conflict between the system iconv.h header and the one from macports. + target_compile_options(liblinphone PRIVATE "-include" "${Iconv_INCLUDE_DIRS}/iconv.h") endif() if(BUILD_SHARED_LIBS) @@ -760,10 +731,12 @@ if(BUILD_SHARED_LIBS) target_compile_definitions(liblinphone PRIVATE "-DDLL_EXPORT" "-DSOCI_DLL") endif() elseif(ANDROID) - if (SUPPORT_FOUND) - target_link_libraries(liblinphone PUBLIC "log" ${SUPPORT_LIBRARIES} ${CPUFEATURES_LIBRARIES}) - else() - target_link_libraries(liblinphone PUBLIC "log" ${CPUFEATURES_LIBRARIES}) + target_link_libraries(liblinphone PUBLIC log) + if(CpuFeatures_FOUND) + target_link_libraries(liblinphone PUBLIC ${CpuFeatures_TARGET}) + endif() + if(Support_FOUND) + target_link_libraries(liblinphone PUBLIC ${Support_TARGET}) endif() endif() if(MSVC) @@ -776,7 +749,7 @@ if(BUILD_SHARED_LIBS) endif() endif() -install(TARGETS liblinphone EXPORT ${EXPORT_TARGETS_NAME}Targets +install(TARGETS liblinphone EXPORT ${PROJECT_NAME}Targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index ce9dad4cb2..1d05e1a421 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -22,13 +22,13 @@ ############################################################################ set(OTHER_LIBS_FOR_TESTER - bctoolbox - bctoolbox-tester - ortp - mediastreamer2 - ${BELLESIP_TARGETNAME} - belr - ${XML2_LIBRARIES} ${XSD_LIBRARIES} + ${BCToolbox_tester_TARGET} + ${Ortp_TARGET} + ${Mediastreamer2_TARGET} + ${BelleSIP_TARGET} + ${Belr_TARGET} + ${LibXml2_TARGET} + ${XSD_LIBRARIES} ) if(INTL_FOUND) @@ -37,28 +37,24 @@ endif() if(SQLITE3_FOUND) list(APPEND OTHER_LIBS_FOR_TESTER ${SQLITE3_LIBRARIES}) endif() -if(SOCI_FOUND) - list(APPEND OTHER_LIBS_FOR_TESTER ${SOCI_LIBRARIES} ${SOCI_sqlite3_PLUGIN}) +if(Soci_FOUND) + list(APPEND OTHER_LIBS_FOR_TESTER ${Soci_TARGET} ${Soci_sqlite3_TARGET}) add_definitions(-DHAVE_SOCI=1) endif() if(ZLIB_FOUND) - if (ANDROID) - # Starting NDK r21, libz.a has issues: https://github.com/android/ndk/issues/1179 - list(APPEND OTHER_LIBS_FOR_TESTER z) - else() - list(APPEND OTHER_LIBS_FOR_TESTER ${ZLIB_LIBRARIES}) - endif() + list(APPEND OTHER_LIBS_FOR_TESTER ${ZLIB_TARGET}) endif() -if(OPENLDAP_FOUND) - list(APPEND OTHER_LIBS_FOR_TESTER ${OPENLDAP_LIBRARIES}) +if(OpenLDAP_FOUND) + list(APPEND OTHER_LIBS_FOR_TESTER ${OpenLDAP_TARGETS}) endif() - -if(ZXING_FOUND) - list(APPEND OTHER_LIBS_FOR_TESTER ${ZXING_LIBRARIES}) +if(ZXing_FOUND) + list(APPEND OTHER_LIBS_FOR_TESTER ${ZXing_TARGET}) endif() - -if(TURBOJPEG_FOUND) - list(APPEND OTHER_LIBS_FOR_TESTER ${TURBOJPEG_LIBRARIES}) +if(TurboJpeg_FOUND) + list(APPEND OTHER_LIBS_FOR_TESTER ${TurboJpeg_TARGET}) +endif() +if(XercesC_FOUND) + list(APPEND OTHER_LIBS_FOR_TESTER ${XercesC_TARGET}) endif() if(ENABLE_CXX_WRAPPER) @@ -427,7 +423,7 @@ endif() # on mobile platforms, we compile the tester as a library so that we can link with it directly from native applications if(ANDROID OR IOS) add_library(linphonetester SHARED ${HEADER_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_CXX} ${LINPHONETESTER_RESOURCES}) - target_include_directories(linphonetester PRIVATE ${LINPHONE_INCLUDE_DIRS} ${LIBXSD_INCLUDE_DIRS} ${SOCI_INCLUDE_DIRS}) + target_include_directories(linphonetester PRIVATE ${LINPHONE_INCLUDE_DIRS} ${LIBXSD_INCLUDE_DIRS}) target_link_libraries(linphonetester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER}) #TODO: replace by if(APPLE) when we want to make apple framework on linphone-desktop too if(IOS) @@ -458,7 +454,7 @@ if(ANDROID OR IOS) ) elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") add_library(linphone_tester_static STATIC ${HEADER_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_CXX}) - target_include_directories(linphone_tester_static PRIVATE ${LINPHONE_INCLUDE_DIRS} ${SOCI_INCLUDE_DIRS}) + target_include_directories(linphone_tester_static PRIVATE ${LINPHONE_INCLUDE_DIRS}) target_link_libraries(linphone_tester_static ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER}) set(RUNTIME_COMPONENT_SOURCES @@ -491,10 +487,9 @@ endif() if(NOT ANDROID) if(NOT IOS AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") add_executable(liblinphone-tester ${HEADER_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_CXX} ${SOURCE_FILES_OBJC}) - set_target_properties(liblinphone-tester PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") set_target_properties(liblinphone-tester PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(liblinphone-tester PROPERTIES C_STANDARD 99) - target_include_directories(liblinphone-tester PRIVATE ${LINPHONE_INCLUDE_DIRS} ${SOCI_INCLUDE_DIRS}) + target_include_directories(liblinphone-tester PRIVATE ${LINPHONE_INCLUDE_DIRS}) target_link_libraries(liblinphone-tester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER}) if(APPLE) target_link_libraries(liblinphone-tester "-framework AppKit") @@ -518,10 +513,9 @@ if(NOT ANDROID) endif() add_executable(liblinphone-groupchat-benchmark ${GROUP_CHAT_BENCHMARK_HEADERS} ${GROUP_CHAT_BENCHMARK_SOURCE_C} ${GROUP_CHAT_BENCHMARK_SOURCE_CXX}) - set_target_properties(liblinphone-groupchat-benchmark PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") set_target_properties(liblinphone-groupchat-benchmark PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(liblinphone-groupchat-benchmark PROPERTIES C_STANDARD 99) - target_include_directories(liblinphone-groupchat-benchmark PRIVATE ${LINPHONE_INCLUDE_DIRS} ${SOCI_INCLUDE_DIRS}) + target_include_directories(liblinphone-groupchat-benchmark PRIVATE ${LINPHONE_INCLUDE_DIRS}) target_link_libraries(liblinphone-groupchat-benchmark ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER}) install(TARGETS liblinphone-groupchat-benchmark diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 81ee4164d1..2f3b5d8012 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # CMakeLists.txt -# Copyright (c) 2010-2022 Belledonne Communications SARL. +# Copyright (c) 2010-2023 Belledonne Communications SARL. # ############################################################################ # @@ -22,38 +22,33 @@ ############################################################################ set(USE_BUNDLE ) -if (IOS) +if(IOS) set(USE_BUNDLE MACOSX_BUNDLE) endif() set(LP_AUTO_ANSWER_SOURCE_FILES auto_answer.c) bc_apply_compile_flags(LP_AUTO_ANSWER_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C) add_executable(liblinphone-auto-answer ${USE_BUNDLE} ${LP_AUTO_ANSWER_SOURCE_FILES}) -target_link_libraries(liblinphone-auto-answer ${LINPHONE_LIBS_FOR_TOOLS} mediastreamer2 ortp bctoolbox ${XSD_LIBRARIES}) -set_target_properties(liblinphone-auto-answer PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") +target_link_libraries(liblinphone-auto-answer PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Mediastreamer2_TARGET} ${Ortp_TARGET} ${BCToolbox_TARGET} ${XSD_LIBRARIES}) set_target_properties(liblinphone-auto-answer PROPERTIES LINKER_LANGUAGE CXX) set(LP_SENDMSG_SOURCE_FILES lpsendmsg.c) bc_apply_compile_flags(LP_SENDMSG_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C) add_executable(liblinphone-sendmsg ${USE_BUNDLE} ${LP_SENDMSG_SOURCE_FILES}) -target_link_libraries(liblinphone-sendmsg ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer2 ${XSD_LIBRARIES}) -set_target_properties(liblinphone-sendmsg PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") +target_link_libraries(liblinphone-sendmsg PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Mediastreamer2_TARGET} ${Ortp_TARGET} ${XSD_LIBRARIES}) set_target_properties(liblinphone-sendmsg PROPERTIES LINKER_LANGUAGE CXX) if(ENABLE_XML2) - set(LP_LPC2XML_TEST_SOURCE_FILES lpc2xml_test.c) bc_apply_compile_flags(LP_LPC2XML_TEST_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C) add_executable(liblinphone-lpc2xml-test ${USE_BUNDLE} ${LP_LPC2XML_TEST_SOURCE_FILES}) - target_link_libraries(liblinphone-lpc2xml-test ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer2 ${XSD_LIBRARIES}) - set_target_properties(liblinphone-lpc2xml-test PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") + target_link_libraries(liblinphone-lpc2xml-test PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Mediastreamer2_TARGET} ${Ortp_TARGET} ${XSD_LIBRARIES}) set_target_properties(liblinphone-lpc2xml-test PROPERTIES LINKER_LANGUAGE CXX) set(LP_XML2LPC_TEST_SOURCE_FILES xml2lpc_test.c) bc_apply_compile_flags(LP_XML2LPC_TEST_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C) add_executable(liblinphone-xml2lpc-test ${USE_BUNDLE} ${LP_XML2LPC_TEST_SOURCE_FILES}) - target_link_libraries(liblinphone-xml2lpc-test ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer2 ${XSD_LIBRARIES}) - set_target_properties(liblinphone-xml2lpc-test PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") + target_link_libraries(liblinphone-xml2lpc-test PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Mediastreamer2_TARGET} ${Ortp_TARGET} ${XSD_LIBRARIES}) set_target_properties(liblinphone-xml2lpc-test PROPERTIES LINKER_LANGUAGE CXX) set(LINPHONE_XMLTOOLS liblinphone-lpc2xml-test liblinphone-xml2lpc-test) @@ -62,15 +57,14 @@ endif() set(LP_TEST_ECC_SOURCE_FILES test_ecc.c) bc_apply_compile_flags(LP_TEST_ECC_SOURCE_FILES STRICT_OPTIONS_CPP STRICT_OPTIONS_C) add_executable(liblinphone-test-ecc ${USE_BUNDLE} ${LP_TEST_ECC_SOURCE_FILES}) -target_link_libraries(liblinphone-test-ecc ${LINPHONE_LIBS_FOR_TOOLS} ortp mediastreamer2 bctoolbox ${XSD_LIBRARIES}) -set_target_properties(liblinphone-test-ecc PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}") +target_link_libraries(liblinphone-test-ecc PRIVATE ${LINPHONE_LIBS_FOR_TOOLS} ${Mediastreamer2_TARGET} ${Ortp_TARGET} ${BCToolbox_TARGET} ${XSD_LIBRARIES}) set_target_properties(liblinphone-test-ecc PROPERTIES LINKER_LANGUAGE CXX) -if (NOT IOS) +if(NOT IOS) install(TARGETS liblinphone-auto-answer liblinphone-sendmsg liblinphone-test-ecc ${LINPHONE_XMLTOOLS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) + ) endif() diff --git a/wrappers/cpp/CMakeLists.txt b/wrappers/cpp/CMakeLists.txt index a635163dbf..24e5e49c57 100644 --- a/wrappers/cpp/CMakeLists.txt +++ b/wrappers/cpp/CMakeLists.txt @@ -57,7 +57,7 @@ if(MSVC) endif() target_compile_definitions(liblinphone++ PRIVATE "-DLINPHONECXX_EXPORTS") target_link_libraries(liblinphone++ - PRIVATE bctoolbox belle-sip liblinphone + PRIVATE ${BCToolbox_TARGET} ${BelleSIP_TARGET} liblinphone ) set_target_properties(liblinphone++ PROPERTIES diff --git a/wrappers/swift/CMakeLists.txt b/wrappers/swift/CMakeLists.txt index 6cfffe9347..b9e9460893 100644 --- a/wrappers/swift/CMakeLists.txt +++ b/wrappers/swift/CMakeLists.txt @@ -62,7 +62,6 @@ if (ENABLE_JAZZY_DOC) endif() if (ENABLE_JAZZY_DOC OR ENABLE_SWIFT_WRAPPER_COMPILATION) - cmake_minimum_required(VERSION 3.15) set(CMAKE_Swift_LANGUAGE_VERSION 4.0) enable_language(Swift) @@ -70,9 +69,7 @@ if (ENABLE_JAZZY_DOC OR ENABLE_SWIFT_WRAPPER_COMPILATION) ${CMAKE_CURRENT_BINARY_DIR}/LinphoneWrapper.swift ) - target_link_libraries(linphonesw - PRIVATE ${BCTOOLBOX_CORE_LIBRARIES} ${BELLESIP_LIBRARIES} liblinphone - ) + target_link_libraries(linphonesw PRIVATE ${BCToolbox_TARGET} ${BelleSIP_TARGET} liblinphone) if (NOT ENABLE_SWIFT_WRAPPER_COMPILATION) # LinphoneWrapper.swift is attached to multiple targets: linphonesw linphoneswsource @@ -88,7 +85,7 @@ if (ENABLE_JAZZY_DOC OR ENABLE_SWIFT_WRAPPER_COMPILATION) MACOSX_FRAMEWORK_INFO_PLIST "${PROJECT_SOURCE_DIR}/build/osx/Info.plist.in" ) - install(TARGETS linphonesw EXPORT ${EXPORT_TARGETS_NAME}Targets + install(TARGETS linphonesw EXPORT ${PROJECT_NAME}Targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -- GitLab