nanobind defaults to adding -Os and friends: https://github.com/wjakob/nanobind/blob/b0136fe6ac1967cb2399456adc346a1af06a3b88/docs/api_cmake.rst#L80.

... and LTO should be user defined via cflags.

Rebased onto 2026.1.5, which adds NB_SUPPRESS_WARNINGS above LTO.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,8 +172,9 @@
   _cl
   NB_STATIC # Build static libnanobind (the extension module itself remains a shared library)
   NB_SUPPRESS_WARNINGS
-  LTO
+  PROTECT_STACK
   NOMINSIZE
+  NOSTRIP
   src/wrap_constants.cpp
   src/wrap_cl.cpp
   src/wrap_cl_part_1.cpp
