 +  )
 +foreach(exe ${examples})
 +  add_executable(${exe} ${exe}.c)
-+  target_link_libraries(${exe} libstrophe)
++  target_link_libraries(${exe} PRIVATE libstrophe)
 +  set_property(TARGET ${exe} PROPERTY FOLDER examples)
 +endforeach()
 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
 new file mode 100644
-index 0000000..c540b0a
+index 0000000..fb9fcfe
 --- /dev/null
 +++ b/src/CMakeLists.txt
-@@ -0,0 +1,71 @@
+@@ -0,0 +1,67 @@
 +set(lib_name ${PROJECT_NAME})
 +########################################
-+# source
 +set(${lib_name}_libsrcs
 +  auth.c
 +  common.h

+foreach(exe ${tests})
+  if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${exe}.c) # there are some tests only in repo, not in download
+    add_executable(${exe} ${exe}.c)
+    target_link_libraries(${exe} testlib)
+    add_test(NAME ${exe} COMMAND ${exe})
+    set_property(TARGET ${exe} PROPERTY FOLDER tests)
+  endif()

+install(FILES strophe.h strophepp.h DESTINATION include${verDir}/${PROJECT_NAME})
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000..5de7bc3
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,13 @@
