--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -157,7 +157,11 @@
 set(name ${LIB_NAME})
 set ( BINDIR console )
 add_executable( ${name} ${BINDIR}/tidy.c )
-target_link_libraries( ${name} ${add_LIBS} )
+if (BUILD_SHARED_LIB)
+	target_link_libraries( ${name} tidy-share )
+else()
+	target_link_libraries( ${name} tidy-static )
+endif()
 if (MSVC)
     set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d )
 endif ()
