--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,25 +1,10 @@
-cmake_minimum_required(VERSION 3.6)
+include(CTest)

-set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "build type")
-
-project(workflow_test
-		LANGUAGES C CXX
-)
-
-find_library(LIBRT rt)
+find_package(GTest REQUIRED)
 find_package(OpenSSL REQUIRED)
-find_package(workflow REQUIRED CONFIG HINTS ..)
-include_directories(${OPENSSL_INCLUDE_DIR} ${WORKFLOW_INCLUDE_DIR})
-link_directories(${WORKFLOW_LIB_DIR})
+include_directories(${GTEST_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} ${INC_DIR})
+link_directories(${GTEST_LIB_DIR} ${OPENSSL_LIB_DIR} ${LIB_DIR})

-find_program(CMAKE_MEMORYCHECK_COMMAND valgrind)
-set(memcheck_command ${CMAKE_MEMORYCHECK_COMMAND} ${CMAKE_MEMORYCHECK_COMMAND_OPTIONS} --error-exitcode=1 --leak-check=full)
-
-add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
-
-enable_testing()
-find_package(GTest REQUIRED)
-
 if (WIN32)
 		set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   /MP /wd4200")
 		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4200 /std:c++14")
@@ -32,8 +17,6 @@ set(TEST_LIST
 	task_unittest
 	algo_unittest
 	http_unittest
-	redis_unittest
-	mysql_unittest
 	facilities_unittest
 	graph_unittest
 	memory_unittest
@@ -46,17 +29,11 @@ set(TEST_LIST
 if (APPLE)
 	set(WORKFLOW_LIB workflow pthread OpenSSL::SSL OpenSSL::Crypto)
 else ()
-	set(WORKFLOW_LIB workflow pthread OpenSSL::SSL OpenSSL::Crypto ${LIBRT})
+	set(WORKFLOW_LIB ${PROJECT_NAME}-shared pthread OpenSSL::SSL OpenSSL::Crypto)
 endif ()

 foreach(src ${TEST_LIST})
-	add_executable(${src} EXCLUDE_FROM_ALL ${src}.cc)
+	add_executable(${src} ${src}.cc)
 	target_link_libraries(${src} ${WORKFLOW_LIB} GTest::GTest GTest::Main)
-	add_test(${src} ${src})
-	add_dependencies(check ${src})
+	add_test(NAME ${src} COMMAND ${src})
 endforeach()
-
-foreach(src ${TEST_LIST})
-	add_test(${src}-memory-check ${memcheck_command} ./${src})
-endforeach()
-
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,6 +73,9 @@ endif ()

 add_subdirectory(src)

+enable_testing()
+add_subdirectory(test)
+
 ####CONFIG

 include(CMakePackageConfigHelpers)
@@ -121,6 +124,6 @@ install(

 install(
 	FILES README.md
-	DESTINATION "${CMAKE_INSTALL_DOCDIR}-${PROJECT_VERSION}"
+	DESTINATION "${CMAKE_INSTALL_DOCDIR}"
 	COMPONENT devel
 )
