diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52d2866..d4aada7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,12 @@
-cmake_minimum_required(VERSION 3.14)
-include_directories("/usr/include/postgresql/server/")
+cmake_minimum_required(VERSION 3.13)
 project(hamming C)
 
 set(CMAKE_C_STANDARD 99)
 
 find_package(PostgreSQL REQUIRED)
+
+include_directories(${PostgreSQL_INCLUDE_DIRS})
+
 add_library(hamming SHARED hamming.c)
 target_compile_options(
         hamming
diff --git a/hamming.c b/hamming.c
index e72b136..e89b047 100644
--- a/hamming.c
+++ b/hamming.c
@@ -1,5 +1,5 @@
-#include "postgresql/server/postgres.h"
-#include "postgresql/server/fmgr.h"
+#include <postgres.h>
+#include <fmgr.h>
 
 __always_inline
 static int _distance_8(const char *h1, const char *h2) {