From aea4be130e5ac4677132654d6684914d155a77fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Tue, 15 Jun 2021 12:03:43 +0200 Subject: [PATCH] Provide pkg-config file This allows to use the pkg-config mechanism on supported systems. --- cpp/CMakeLists.txt | 9 +++++++++ cpp/libphonenumber.pc.in | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 cpp/libphonenumber.pc.in diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 96def5c8f..b67eee59d 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -712,6 +712,15 @@ configure_package_config_file("cmake/config.cmake.in" "${project_config}" INSTAL install(FILES "${project_config}" "${version_config}" DESTINATION "${config_install_dir}") install(EXPORT "${targets_export_name}" NAMESPACE ${PROJECT_NAME}:: DESTINATION "${config_install_dir}") +#---------------------------------------------------------------- +# Build and install pkg-config file +#---------------------------------------------------------------- +if (BUILD_SHARED_LIBS AND UNIX) + configure_file(libphonenumber.pc.in libphonenumber.pc @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libphonenumber.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +endif () + #---------------------------------------------------------------- # Build an RPM #---------------------------------------------------------------- diff --git a/cpp/libphonenumber.pc.in b/cpp/libphonenumber.pc.in new file mode 100644 index 000000000..c500b39a1 --- /dev/null +++ b/cpp/libphonenumber.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: libphonenumber +Description: Parse, format, store and validate international phone numbers +URL: https://github.com/google/libphonenumber +Version: @CMAKE_PROJECT_VERSION@ +Libs: -L${libdir} -lphonenumber