diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7e4bb3ce..c4f4040c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1060,6 +1060,8 @@ foreach (man ${mans})
 endforeach()
 
 set(prefix ${CMAKE_INSTALL_PREFIX})
+cmake_path(APPEND libdir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
+cmake_path(APPEND includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
 configure_file(getdns.pc.in getdns.pc @ONLY)
 
 # Installing.
diff --git a/ChangeLog b/ChangeLog
index 472a8014..5ee2a258 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
 * 2022-08-??: Version 1.7.1
   * Always send the `dot` ALPN when using DoT
-  * Strengthen version determination for Libidn2 during cmake processing (thanks
-    jpbion).
+  * Strengthen version determination for Libidn2 during cmake processing
+    (thanks jpbion).
   * Fix for issue in UDP stream selection in case of timeouts.
     Thanks Shikha Sharma
   * Fix using asterisk in ipstr for any address. Thanks uzlonewolf.
@@ -10,6 +10,8 @@
     via GETDNS_BUILD_CFLAGS define and via getdns_context_get_api_information()
   * Issue #524: Bug fixes from submodules' upstream?
     Thanks Johnnyslee
+  * Issue #517: Allow Absolute path CMAKE_INSTALL_{INCLUDE,LIB}DIR in pkg-config
+    files. Thanks Alex Shpilkin
 
 * 2021-06-04: Version 1.7.0
   * Make TLS Handshake timeout max 4/5th of timeout for the query,
diff --git a/getdns.pc.in b/getdns.pc.in
index a2a3ca92..edcce553 100644
--- a/getdns.pc.in
+++ b/getdns.pc.in
@@ -1,7 +1,7 @@
 prefix=@prefix@
 exec_prefix=${prefix}
-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+libdir=@libdir_for_pc_file@
+includedir=@includedir_for_pc_file@
 
 Name: getdns
 Version: @GETDNS_VERSION@