THRIFT-3106 CMake summary should give more information why a library is set to off

Patch: Pascal Bach
This closes #454
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index a8b40c2..d5880de 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -34,9 +34,10 @@
 # much as possible but leaving out libraries if their dependencies are not met.
 
 # C++
+option(WITH_CPP "Build C++ Thrift library" ON)
 find_package(Boost 1.53 QUIET)
-CMAKE_DEPENDENT_OPTION(WITH_CPP "Build C++ library" ON
-                       "BUILD_LIBRARIES;Boost_FOUND" OFF)
+CMAKE_DEPENDENT_OPTION(BUILD_CPP "Build C++ library" ON
+                       "BUILD_LIBRARIES;WITH_CPP;Boost_FOUND" OFF)
 # NOTE: Currently the following options are C++ specific,
 # but in future other libraries might reuse them.
 # So they are not dependent on WITH_CPP but setting them without WITH_CPP currently
@@ -64,20 +65,23 @@
 option(WITH_STDTHREADS "Build with C++ std::thread support" OFF)
 
 # C GLib
+option(WITH_C_GLIB "Build C (GLib) Thrift library" ON)
 find_package(GLIB QUIET COMPONENTS gobject)
-CMAKE_DEPENDENT_OPTION(WITH_C_GLIB "Build C (GLib) library" ON
-                       "BUILD_LIBRARIES;GLIB_FOUND" OFF)
+CMAKE_DEPENDENT_OPTION(BUILD_C_GLIB "Build C (GLib) library" ON
+                       "BUILD_LIBRARIES;WITH_C_GLIB;GLIB_FOUND" OFF)
 # Java
+option(WITH_JAVA "Build Java Thrift library" ON)
 find_package(Java QUIET)
 find_package(Ant QUIET)
-CMAKE_DEPENDENT_OPTION(WITH_JAVA "Build Java library" ON
-                       "BUILD_LIBRARIES;JAVA_FOUND;ANT_FOUND" OFF)
+CMAKE_DEPENDENT_OPTION(BUILD_JAVA "Build Java library" ON
+                       "BUILD_LIBRARIES;WITH_JAVA;JAVA_FOUND;ANT_FOUND" OFF)
 
 # Python
-include(FindPythonInterp QUIET) # for Python executable
-include(FindPythonLibs QUIET) # for Python.h
-CMAKE_DEPENDENT_OPTION(WITH_PYTHON "Build Python library" ON
-                       "BUILD_LIBRARIES;PYTHONLIBS_FOUND" OFF)
+option(WITH_PYTHON "Build Python Thrift library" ON)
+find_package(PythonInterp QUIET) # for Python executable
+find_package(PythonLibs QUIET) # for Python.h
+CMAKE_DEPENDENT_OPTION(BUILD_PYTHON "Build Python library" ON
+                       "BUILD_LIBRARIES;WITH_PYTHON;PYTHONLIBS_FOUND" OFF)
 
 # Common library options
 option(WITH_SHARED_LIB "Build shared libraries" ON)
@@ -90,6 +94,12 @@
 option(WITH_MT "Build unsing MT instead of MT (MSVC only)" OFF)
 endif(MSVC)
 
+macro(MESSAGE_DEP flag summary)
+if(NOT ${flag})
+  message(STATUS "   - ${summary}")
+endif()
+endmacro(MESSAGE_DEP flag summary)
+
 macro(PRINT_CONFIG_SUMMARY)
 message(STATUS "----------------------------------------------------------")
 message(STATUS "Thrift version:                       ${thrift_VERSION} (${thrift_VERSION_MAJOR}.${thrift_VERSION_MINOR}.${thrift_VERSION_PATCH})")
@@ -100,10 +110,19 @@
 message(STATUS "  Build examples:                     ${BUILD_EXAMPLES}")
 message(STATUS "  Build Thrift libraries:             ${BUILD_LIBRARIES}")
 message(STATUS " Language libraries:")
-message(STATUS "  Build C++ library:                  ${WITH_CPP}")
-message(STATUS "  Build C (GLib) library:             ${WITH_C_GLIB}")
-message(STATUS "  Build Java library:                 ${WITH_JAVA}")
-message(STATUS "  Build Python library:               ${WITH_PYTHON}")
+message(STATUS "  Build C++ library:                  ${BUILD_CPP}")
+MESSAGE_DEP(WITH_CPP "Disabled by via WITH_CCP=OFF")
+MESSAGE_DEP(Boost_FOUND "Boost headers missing")
+message(STATUS "  Build C (GLib) library:             ${BUILD_C_GLIB}")
+MESSAGE_DEP(WITH_C_GLIB "Disabled by via WITH_C_GLIB=OFF")
+MESSAGE_DEP(GLIB_FOUND "GLib missing")
+message(STATUS "  Build Java library:                 ${BUILD_JAVA}")
+MESSAGE_DEP(WITH_JAVA "Disabled by via WITH_JAVA=OFF")
+MESSAGE_DEP(JAVA_FOUND "Java Runtime missing")
+MESSAGE_DEP(ANT_FOUND "Ant missing")
+message(STATUS "  Build Python library:               ${BUILD_PYTHON}")
+MESSAGE_DEP(WITH_PYTHON "Disabled by via WITH_PYTHON=OFF")
+MESSAGE_DEP(PYTHONLIBS_FOUND "Python libraries missing")
 message(STATUS " Library features:")
 message(STATUS "  Build shared libraries:             ${WITH_SHARED_LIB}")
 message(STATUS "  Build static libraries:             ${WITH_STATIC_LIB}")