 +  test_string
 +  )
 +foreach(exe ${tests})
-+  if(EXISTS ${exe}.c) # there are some tests only in repo, not in download
++  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()
 +endforeach()

+foreach(exe ${examples})
+  add_executable(${exe} ${exe}.c)
+  target_link_libraries(${exe} libstrophe expat resolv) # TODO library dependencies
+endforeach()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..7cdf770
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,35 @@
+cmake_minimum_required(VERSION 3.0)
+project(libstrophe)
+include(flags OPTIONAL)
+enable_testing()
+set_property(GLOBAL PROPERTY USE_FOLDERS ON) # enables MSVC Solution Folders
+########################################
+if(MSVC)
+  add_definitions(
+    -D_CRT_NONSTDC_NO_DEPRECATE
+    -D_CRT_SECURE_NO_WARNINGS
+    -D_WINSOCK_DEPRECATED_NO_WARNINGS
+    )
+  if(COMMAND xpStringAppendIfDne)
+    xpStringAppendIfDne(CMAKE_CXX_FLAGS "/wd4244") # conversion from x to y, possible loss of data
+    xpStringAppendIfDne(CMAKE_CXX_FLAGS "/wd4267") # conversion from x to y, possible loss of data
+  endif()
+endif()
+########################################
+# version
+set(verString "^AC_INIT.*\\[\([.0-9]*\)\\].*")
