diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ find_package(ECM 0.0.9 REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake) include(KDEInstallDirs) include(KDECMakeSettings) @@ -33,9 +33,6 @@ TYPE REQUIRED PURPOSE "Required for interacting with the compositor") - -feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) - include(CheckIncludeFiles) plasma_install_package(look-and-feel org.kde.plasma.phone look-and-feel) @@ -64,3 +61,5 @@ add_subdirectory(dialer) add_subdirectory(sounds) #add_subdirectory(touchscreentest) + +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/cmake/FindPhoneNumber.cmake b/cmake/FindPhoneNumber.cmake new file mode 100644 --- /dev/null +++ b/cmake/FindPhoneNumber.cmake @@ -0,0 +1,89 @@ +#.rst: +# FindPhoneNumber +# --------------- +# +# This module finds if PhoneNumber is installed. +# If found, this will define the following variables: +# +# ``PhoneNumber_FOUND`` +# Set to TRUE if PhoneNumber was found. +# ``PhoneNumber_LIBRARIES`` +# Path to PhoneNumber libraries. +# ``PhoneNumber_INCLUDE_DIR`` +# Path to the PhoneNumber include directory. +# ``PhoneNumberGeoCoding_LIBRARIES`` +# Path to PhoneNumber GeoCodeing libraries. +# +# If ``PhoneNumber_FOUND`` is TRUE the following imported targets +# will be defined: +# +# ``PhoneNumber::PhoneNumber`` +# The PhoneNumber library +# ``PhoneNumber::GeoCoding`` +# The PhoneNumber geo coding library +# + +#============================================================================= +# Copyright (c) 2017 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com +# Copyright (c) 2018 Volker Krause +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +include(FindPackageHandleStandardArgs) + +find_library(PhoneNumber_LIBRARIES + NAMES phonenumber + PATH_SUFFIXES lib + HINTS ENV PHONENUMBERDIR) + +find_path(PhoneNumber_INCLUDE_DIR + NAMES phonenumbers/phonenumberutil.h + HINTS ENV PHONENUMBERDIR) + +find_library(PhoneNumberGeoCoding_LIBRARIES + NAMES geocoding + PATH_SUFFIXES lib + HINTS ENV PHONENUMBERDIR) + +mark_as_advanced(PhoneNumber_LIBRARIES PhoneNumber_INCLUDE_DIR) +mark_as_advanced(PhoneNumberGeoCoding_LIBRARIES) + +find_package_handle_standard_args(PhoneNumber DEFAULT_MSG PhoneNumber_LIBRARIES PhoneNumber_INCLUDE_DIR PhoneNumberGeoCoding_LIBRARIES) + +if(PhoneNumber_FOUND AND NOT TARGET PhoneNumber::PhoneNumber) + add_library(PhoneNumber::PhoneNumber UNKNOWN IMPORTED) + set_target_properties(PhoneNumber::PhoneNumber PROPERTIES + IMPORTED_LOCATION "${PhoneNumber_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${PhoneNumber_INCLUDE_DIR}") + add_library(PhoneNumber::GeoCoding UNKNOWN IMPORTED) + set_target_properties(PhoneNumber::GeoCoding PROPERTIES + IMPORTED_LOCATION "${PhoneNumberGeoCoding_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${PhoneNumber_INCLUDE_DIR}") +endif() + +include(FeatureSummary) +set_package_properties(PhoneNumber PROPERTIES + URL "https://github.com/googlei18n/libphonenumber" + DESCRIPTION "Library for parsing, formatting, and validating international phone numbers") diff --git a/dialer/src/CMakeLists.txt b/dialer/src/CMakeLists.txt --- a/dialer/src/CMakeLists.txt +++ b/dialer/src/CMakeLists.txt @@ -11,10 +11,10 @@ target_compile_definitions(plasmaphonedialer PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}") #find_package(ActiveApp REQUIRED) -find_library(phonenumber REQUIRED) +find_package(PhoneNumber REQUIRED) target_link_libraries(plasmaphonedialer - phonenumber + PhoneNumber::PhoneNumber Qt5::Gui Qt5::Quick Qt5::Widgets