--- ./CMakeLists.txt.orig	2011-10-02 18:12:43.000000000 +0300
+++ ./CMakeLists.txt	2011-10-10 11:16:46.000000000 +0300
@@ -212,14 +212,14 @@
 
     if (USE_LIBGNOME2)
         message (STATUS "Building with LibGnome2 support")
-        find_package (LibGnome2 REQUIRED)
+		find_library(LIBGNOME2_LIBRARIES gnome-2)
     else (USE_LIBGNOME2)
         message (STATUS "Building without LibGnome2 support")
     endif (USE_LIBGNOME2)
 
     if (USE_LIBNOTIFY)
         message (STATUS "Building with libnotify support")
-        set (LIBNOTIFY "-lnotify")
+		find_library(LIBNOTIFY notify)
     else (USE_LIBNOTIFY)
         message (STATUS "Building without libnotify support")
     endif (USE_LIBNOTIFY)
@@ -370,16 +370,14 @@
     else (MINGW)
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
     endif (MINGW)
-    if (NOT APPLE)
-        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--as-needed")
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--as-needed")
-    endif (NOT APPLE)
     set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -pipe -DNDEBUG")
     set (CMAKE_CXX_FLAGS_RELEASE     "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG -pipe")
     set (CMAKE_CXX_FLAGS_DEBUG       "${CMAKE_CXX_FLAGS_DEBUG} -UNDEBUG -g3 -pipe")
 endif ()
 
-include_directories(${eiskaltdcpp_BINARY_DIR}
+include_directories(
+   ${EISKALTDCPP_INCLUDE_DIR}
+   ${eiskaltdcpp_BINARY_DIR}
    ${eiskaltdcpp_SOURCE_DIR}
    ${GMP_INCLUDE_DIR}
    )
@@ -451,7 +449,9 @@
   add_subdirectory (dht)
 endif (WITH_DHT)
 
-add_subdirectory (dcpp)
+if (BUILD_LIB)
+	add_subdirectory (dcpp)
+endif (BUILD_LIB)
 
 if (USE_QT)
   add_subdirectory (eiskaltdcpp-qt)
@@ -482,7 +482,7 @@
     add_subdirectory(cmake)
 endif(GETTEXT_FOUND)
 
-if (USE_QT OR USE_GTK)
+if (INSTALL_DATA AND (USE_QT OR USE_GTK))
 
     if (WITH_EXAMPLES)
         install (DIRECTORY examples/ DESTINATION ${CLIENT_DATA_DIR}/examples
@@ -524,4 +524,4 @@
     install (FILES icons/icon_128x128.png DESTINATION ${SHARE_DIR}/pixmaps/ RENAME eiskaltdcpp.png)
   endif (NOT HAIKU)
 endif (APPLE)
-endif (USE_QT OR USE_GTK)
+endif (INSTALL_DATA AND (USE_QT OR USE_GTK))
