--- CMakeLists.txt.orig	2024-01-23 23:51:19 UTC
+++ CMakeLists.txt
@@ -11,7 +11,9 @@ cmake_policy(SET CMP0094 NEW)
 cmake_policy(SET CMP0094 NEW)
 
 # 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)
 
@@ -25,7 +27,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)
+    target_compile_options(python-samplerate PRIVATE -std=c++14 -Wall -Wextra)
 endif()
 
 ### stick the package and libsamplerate version into the module
@@ -43,4 +45,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}
+)
