diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 27e4680cc..86cbcc8ff 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