diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6cb0e20f2459d2b4e726c9142bcd9b67fd0f6f4..82acc83fc446db08e0a7c68ca28dbf8b478a5489 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,10 +213,11 @@ if (ENABLE_BACKTRACE)
     endif()
     # Use GNU bfd if present.
     check_library_exists (bfd bfd_init ""  HAVE_BFD_LIB)
+    check_library_exists (iberty cplus_demangle "" HAVE_IBERTY_LIB)
     set(CMAKE_REQUIRED_DEFINITIONS -DPACKAGE=${PACKAGE} -DPACKAGE_VERSION=${PACKAGE_VERSION})
     check_include_file(bfd.h HAVE_BFD_H)
     set(CMAKE_REQUIRED_DEFINITIONS)
-    if (HAVE_BFD_LIB AND HAVE_BFD_H)
+    if (HAVE_BFD_LIB AND HAVE_BFD_H AND HAVE_IBERTY_LIB)
         set (HAVE_BFD True)
     endif()
 endif()
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 856f1a6a1ab17e1aa3fd6a3ae7dc79f2c7745fd5..1cf805e523f61cdd94759c724adedf6524caa70c 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -13,7 +13,7 @@ add_subdirectory(man)
 if (ENABLE_DOC)
     add_subdirectory(user)
     add_subdirectory(developer)
+    add_subdirectory(www-data.in)
 endif()
 
 
-add_subdirectory(www-data.in)