diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index bb5d4282141f86bc710593ce3ec30b26f0e95bcf..05bd8eee5093d602d47302db845bd9c39ef2274a 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -78,7 +78,7 @@ target_include_directories(
 # Using pybind11 requires using -fvisibility=hidden. See
 # https://pybind11.readthedocs.io/en/stable/faq.html
 target_compile_options(radler PUBLIC -O3 -Wall -Wzero-as-null-pointer-constant
-                                     -fvisibility=hidden)
+                                     -fvisibility=hidden -fPIC)
 
 if(NOT PORTABLE)
   if(DEFINED TARGET_CPU)