Repository: thrift Updated Branches: refs/heads/master aeb89aa81 -> 3b99c970a
THRIFT-3106 CMake summary should give more information why a library is set to off Patch: Pascal Bach This closes #454 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/3b99c970 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/3b99c970 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/3b99c970 Branch: refs/heads/master Commit: 3b99c970ad0c9fa2ca009f7b00aaeb902ee9850a Parents: aeb89aa Author: Roger Meier <[email protected]> Authored: Mon Apr 20 22:49:48 2015 +0200 Committer: Roger Meier <[email protected]> Committed: Mon Apr 20 22:49:48 2015 +0200 ---------------------------------------------------------------------- CMakeLists.txt | 8 +++--- build/cmake/DefineOptions.cmake | 47 +++++++++++++++++++++++++----------- lib/c_glib/test/CMakeLists.txt | 6 ++--- 3 files changed, 40 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/3b99c970/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 386a63d..70bdb75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,7 @@ if(BUILD_COMPILER) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/compiler/cpp) endif() -if(WITH_CPP) +if(BUILD_CPP) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/cpp) if(BUILD_TESTING) if(WITH_LIBEVENT AND WITH_ZLIB AND WITH_OPENSSL) @@ -83,15 +83,15 @@ if(WITH_CPP) endif() endif() -if(WITH_C_GLIB) +if(BUILD_C_GLIB) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/c_glib) endif() -if(WITH_JAVA) +if(BUILD_JAVA) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/java) endif() -if(WITH_PYTHON) +if(BUILD_PYTHON) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/py) endif() http://git-wip-us.apache.org/repos/asf/thrift/blob/3b99c970/build/cmake/DefineOptions.cmake ---------------------------------------------------------------------- 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 @@ option(BUILD_LIBRARIES "Build Thrift libraries" ON) # 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_BOOSTTHREADS "Build with Boost thread support" OFF) 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 @@ if(MSVC) 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 with unit tests: ${BUILD_TESTING}") 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}") http://git-wip-us.apache.org/repos/asf/thrift/blob/3b99c970/lib/c_glib/test/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/lib/c_glib/test/CMakeLists.txt b/lib/c_glib/test/CMakeLists.txt index e3e5ea4..31e6c6b 100644 --- a/lib/c_glib/test/CMakeLists.txt +++ b/lib/c_glib/test/CMakeLists.txt @@ -25,7 +25,7 @@ set(TEST_PREFIX "c_glib") include_directories(${Boost_INCLUDE_DIRS}) -# Create the thrift C++ test library +# Create the thrift C test library set(testgenc_SOURCES gen-c_glib/t_test_debug_proto_test_types.c gen-c_glib/t_test_empty_service.c @@ -94,7 +94,7 @@ target_link_libraries(testthrifttest testgenc) add_test(NAME testthrifttest COMMAND testthrifttest) -if(WITH_CPP) +if(BUILD_CPP) include_directories("${PROJECT_SOURCE_DIR}/lib/cpp/src") @@ -119,7 +119,7 @@ if(WITH_CPP) target_link_libraries(testthrifttestclient testgenc testgenc_cpp) add_test(NAME testthrifttestclient COMMAND testthrifttestclient) -endif(WITH_CPP) +endif(BUILD_CPP) # # Common thrift code generation rules
