--- CMakeLists.txt.orig	2026-03-22 18:12:56 UTC
+++ CMakeLists.txt
@@ -9,7 +9,9 @@ set(PYBIND11_FINDPYTHON ON)
 set(PYBIND11_FINDPYTHON ON)
 
 # adds the external dependencies
-add_subdirectory(external)
+find_package(PkgConfig REQUIRED)
+find_package(pybind11 CONFIG REQUIRED)
+pkg_check_modules(SAMPLERATE REQUIRED IMPORTED_TARGET samplerate)
 
 pybind11_add_module(python-samplerate src/samplerate.cpp)
 
@@ -23,7 +25,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
     CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
     (CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND NOT WIN32))
-    target_compile_options(python-samplerate PRIVATE -std=c++14 -O3 -Wall -Wextra -fPIC)
+    target_compile_options(python-samplerate PRIVATE -std=c++14 -Wall -Wextra -fPIC)
 endif()
 
 ### stick the package and libsamplerate version into the module
@@ -41,4 +43,9 @@ set_target_properties(
         LINKER_LANGUAGE C
     )
 
-target_link_libraries(python-samplerate PUBLIC samplerate)
+target_compile_options(python-samplerate PRIVATE
+	${SAMPLERATE_CFLAGS}
+)
+target_link_options(python-samplerate PRIVATE
+	${SAMPLERATE_LDFLAGS}
+)
