diff --git a/examples/libtest/CMakeLists.txt b/examples/libtest/CMakeLists.txt
index 907f3ba5b..4458322ff 100644
--- a/examples/libtest/CMakeLists.txt
+++ b/examples/libtest/CMakeLists.txt
@@ -35,6 +35,6 @@ if(CONFIG_EXAMPLES_LIBTEST)
   endif()
 
   nuttx_add_library(libtest STATIC)
-  target_sources(libtest libtest.c)
+  target_sources(libtest PRIVATE libtest.c)
 
 endif()