From ca5c1dc31baca3c4645a6322e03e0224a2cd3258 Mon Sep 17 00:00:00 2001 From: Vladimir Chebotarev Date: Tue, 6 Dec 2016 19:51:34 +0300 Subject: [PATCH] cmake: Improved build. [#METR-21516] --- CMakeLists.txt | 20 ++--- cmake/find_glib.cmake | 39 ++++++++ cmake/find_libmysqlclient.cmake | 9 ++ cmake/find_openssl.cmake | 17 +++- contrib/libpoco/CMakeLists.txt | 90 +++++++++---------- contrib/libpoco/Crypto/CMakeLists.txt | 2 +- contrib/libpoco/Data/CMakeLists.txt | 10 +-- contrib/libpoco/Data/MySQL/CMakeLists.txt | 2 +- contrib/libpoco/Data/ODBC/CMakeLists.txt | 2 +- contrib/libpoco/Foundation/CMakeLists.txt | 2 +- contrib/libpoco/JSON/CMakeLists.txt | 2 +- contrib/libpoco/MongoDB/CMakeLists.txt | 2 +- contrib/libpoco/Net/CMakeLists.txt | 2 +- contrib/libpoco/NetSSL_OpenSSL/CMakeLists.txt | 2 +- contrib/libpoco/Util/CMakeLists.txt | 6 +- contrib/libpoco/XML/CMakeLists.txt | 2 +- contrib/libpoco/Zip/CMakeLists.txt | 2 +- doc/build.md | 2 +- doc/build_osx.md | 2 +- doc/getting_started/getting_started_en.md | 2 +- doc/getting_started/getting_started_ru.md | 2 +- libs/libcommon/CMakeLists.txt | 26 +----- libs/libmysqlxx/CMakeLists.txt | 13 +-- libs/libmysqlxx/include/mysqlxx/Exception.h | 2 +- libs/libmysqlxx/include/mysqlxx/Pool.h | 2 +- libs/libmysqlxx/include/mysqlxx/Types.h | 2 +- libs/libmysqlxx/src/tests/CMakeLists.txt | 6 +- release | 2 +- 28 files changed, 146 insertions(+), 126 deletions(-) create mode 100644 cmake/find_glib.cmake create mode 100644 cmake/find_libmysqlclient.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 50bdc64ab8e..f6e8ec73928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 2.6) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # Require at least gcc 5 - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5 AND NOT CMAKE_VERSION VERSION_LESS 2.8.9) message (FATAL_ERROR "GCC version must be at least 5! For example, if GCC 5 is available under gcc-5, g++-5 names, do the following: export CC=gcc-5 CXX=g++-5; rm -rf CMakeCache.txt CMakeFiles; and re run cmake or ./release.") endif () elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") @@ -19,8 +19,8 @@ if (APPLE) set (APPLE_EXTRA_CXX_FLAG "-Dexp10=__exp10") # Also needed for libc++ endif () -cmake_policy(SET CMP0014 OLD) # Ignore warning about CMakeLists.txt in each directory -cmake_policy(SET CMP0012 NEW) # Don't dereference TRUE and FALSE +cmake_policy (SET CMP0014 OLD) # Ignore warning about CMakeLists.txt in each directory +cmake_policy (SET CMP0012 NEW) # Don't dereference TRUE and FALSE if (NOT CMAKE_BUILD_TYPE) message (STATUS "CMAKE_BUILD_TYPE is not set, set to default = RELWITHDEBINFO") @@ -96,7 +96,7 @@ set (CMAKE_C_FLAGS_DEBUG "-O0 -g3 -ggdb3 -fno-inline") if (NOT APPLE) set (CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ ${GLIBC_COMPATIBILITY_LINK_FLAGS} ${CXX11_ABI}") -endif() +endif () # -fuse-ld=gold - fix linkage for gcc-5.4, gcc-6.1 # See more in http://stackoverflow.com/questions/37603238/fsanitize-not-using-gold-linker-in-gcc-6-1 @@ -155,17 +155,6 @@ include_directories (${ClickHouse_SOURCE_DIR}/libs/libzkutil/include/) include_directories (${ClickHouse_SOURCE_DIR}/dbms/include) -include_directories (/usr/local/include/glib-2.0/) -include_directories (/usr/local/lib/glib-2.0/include/) -include_directories (/usr/include/glib-2.0/) -include_directories (/usr/lib64/glib-2.0/include/) - -if (AARCH64) - include_directories (/usr/lib/aarch64-linux-gnu/glib-2.0/include/) -else () - include_directories (/usr/lib/x86_64-linux-gnu/glib-2.0/include/) -endif () - include_directories (/usr/local/include/) link_directories (/usr/local/lib) @@ -174,6 +163,7 @@ include (cmake/find_openssl.cmake) include (cmake/find_icu4c.cmake) include (cmake/find_boost.cmake) include (cmake/find_libtool.cmake) +include (cmake/find_libmysqlclient.cmake) # Directory for Yandex specific files set (CLICKHOUSE_PRIVATE_DIR ${ClickHouse_SOURCE_DIR}/private/) diff --git a/cmake/find_glib.cmake b/cmake/find_glib.cmake new file mode 100644 index 00000000000..3e7dd005e7b --- /dev/null +++ b/cmake/find_glib.cmake @@ -0,0 +1,39 @@ +set (GLIB_HINTS "/usr/local/opt/glib/lib") +set (GLIB_INCLUDE_HINTS + "/usr/local/include/glib-2.0/" + "/usr/local/lib/glib-2.0/include/" + "/usr/include/glib-2.0/" + "/usr/lib64/glib-2.0/include/") +if (AARCH64) + set (GLIB_INCLUDE_HINTS ${GLIB_INCLUDE_HINTS} "/usr/lib/aarch64-linux-gnu/glib-2.0/include/") +else () + set (GLIB_INCLUDE_HINTS ${GLIB_INCLUDE_HINTS} "/usr/lib/x86_64-linux-gnu/glib-2.0/include/") +endif () +if (USE_STATIC_LIBRARIES) + find_library (GLIB_LIB libglib-2.0.a HINTS ${GLIB_HINTS}) +else () + find_library (GLIB_LIB glib-2.0 HINTS ${GLIB_HINTS}) +endif () +find_path (GLIB_INCLUDE_DIR NAMES glib.h HINTS ${GLIB_INCLUDE_HINTS}) +find_path (GLIB_CONFIG_INCLUDE_DIR NAMES glibconfig.h HINTS ${GLIB_INCLUDE_HINTS}) +include_directories (${GLIB_INCLUDE_DIR}) +include_directories (${GLIB_CONFIG_INCLUDE_DIR}) +if (APPLE) + set (INTL_HINTS "/usr/local/opt/gettext/lib") + if (USE_STATIC_LIBRARIES) + find_library (INTL_LIB libintl.a HINTS ${INTL_HINTS}) + else () + find_library (INTL_LIB intl HINTS ${INTL_HINTS}) + endif () + set (ICONV_HINTS "/usr/local/opt/libiconv/lib") + if (USE_STATIC_LIBRARIES) + find_library (ICONV_LIB libiconv.a HINTS ${ICONV_HINTS}) + else () + find_library (ICONV_LIB iconv HINTS ${ICONV_HINTS}) + endif () + find_library (CORE_FOUNDATION_LIB CoreFoundation) + find_library (CARBON_LIB Carbon) + set (GLIB_LIBS ${GLIB_LIB} ${INTL_LIB} ${ICONV_LIB} ${CORE_FOUNDATION_LIB} ${CARBON_LIB}) +else (APPLE) + set (GLIB_LIBS ${GLIB_LIB}) +endif (APPLE) diff --git a/cmake/find_libmysqlclient.cmake b/cmake/find_libmysqlclient.cmake new file mode 100644 index 00000000000..10c18a14890 --- /dev/null +++ b/cmake/find_libmysqlclient.cmake @@ -0,0 +1,9 @@ +set (MYSQL_HINTS "/usr/local/opt/mysql/lib") +set (MYSQL_INCLUDE_HINTS "/usr/local/opt/mysql/include") +if (USE_STATIC_LIBRARIES) + find_library (STATIC_MYSQLCLIENT_LIB libmysqlclient.a HINTS ${MYSQL_HINTS}) +else () + find_library (MYSQLCLIENT_LIB mysqlclient HINTS ${MYSQL_HINTS}) +endif () +find_path (MYSQL_INCLUDE_DIR NAMES mysql.h PATH_SUFFIXES mysql HINTS ${MYSQL_INCLUDE_HINTS}) +include_directories (${MYSQL_INCLUDE_DIR}) diff --git a/cmake/find_openssl.cmake b/cmake/find_openssl.cmake index 9ea207e0c1d..4a09a59f709 100644 --- a/cmake/find_openssl.cmake +++ b/cmake/find_openssl.cmake @@ -3,6 +3,19 @@ if (APPLE) set (OPENSSL_ROOT_DIR "/usr/local/opt/openssl") endif () find_package (OpenSSL) -if (NOT OPENSSL_FOUND) - message (SEND_ERROR "OpenSSL is required") +if (OPENSSL_FOUND) + include_directories (${OPENSSL_INCLUDE_DIR}) +endif () +if (NOT OPENSSL_FOUND) + # Try to find manually. + include_directories ("/usr/local/opt/openssl/include") + set (OPENSSL_HINTS "/usr/local/opt/openssl/lib") + if (USE_STATIC_LIBRARIES) + find_library (OPENSSL_SSL_LIBRARY libssl.a HINTS ${OPENSSL_HINTS}) + find_library (OPENSSL_CRYPTO_LIBRARY libcrypto.a HINTS ${OPENSSL_HINTS}) + else () + find_library (OPENSSL_SSL_LIBRARY ssl HINTS ${OPENSSL_HINTS}) + find_library (OPENSSL_CRYPTO_LIBRARY crypto HINTS ${OPENSSL_HINTS}) + endif () + set (OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) endif () diff --git a/contrib/libpoco/CMakeLists.txt b/contrib/libpoco/CMakeLists.txt index 8c3a70df5a0..52922bba08f 100644 --- a/contrib/libpoco/CMakeLists.txt +++ b/contrib/libpoco/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 2.8.0) # POCO_UNBUNDLED # POCO_NO_LOCALE # -# ENABLE_{COMPONENT} -# ENABLE_TESTS +# POCO_ENABLE_{COMPONENT} +# POCO_ENABLE_TESTS project(Poco) @@ -68,30 +68,30 @@ set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE) include(PocoMacros) # Allow enabling and disabling components -option(ENABLE_XML "Enable the XML" ON) -option(ENABLE_JSON "Enable the JSON" ON) -option(ENABLE_MONGODB "Enable MongoDB" ON) -option(ENABLE_PDF "Enable PDF" OFF) -option(ENABLE_UTIL "Enable Util" ON) -option(ENABLE_NET "Enable Net" ON) -option(ENABLE_NETSSL "Enable NetSSL" ON) -option(ENABLE_NETSSL_WIN "Enable NetSSL Windows" OFF) -option(ENABLE_CRYPTO "Enable Crypto" ON) -option(ENABLE_DATA "Enable Data" ON) -option(ENABLE_DATA_SQLITE "Enable Data SQlite" OFF) -option(ENABLE_DATA_MYSQL "Enable Data MySQL" OFF) -option(ENABLE_DATA_ODBC "Enable Data ODBC" ON) -option(ENABLE_SEVENZIP "Enable SevenZip" OFF) -option(ENABLE_ZIP "Enable Zip" ON) -option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF) -option(ENABLE_CPPPARSER "Enable C++ parser" OFF) -option(ENABLE_POCODOC "Enable Poco Documentation Generator" OFF) -option(ENABLE_PAGECOMPILER "Enable PageCompiler" ON) -option(ENABLE_PAGECOMPILER_FILE2PAGE "Enable File2Page" ON) +option(POCO_ENABLE_XML "Enable the XML" ON) +option(POCO_ENABLE_JSON "Enable the JSON" ON) +option(POCO_ENABLE_MONGODB "Enable MongoDB" ON) +option(POCO_ENABLE_PDF "Enable PDF" OFF) +option(POCO_ENABLE_UTIL "Enable Util" ON) +option(POCO_ENABLE_NET "Enable Net" ON) +option(POCO_ENABLE_NETSSL "Enable NetSSL" ON) +option(POCO_ENABLE_NETSSL_WIN "Enable NetSSL Windows" OFF) +option(POCO_ENABLE_CRYPTO "Enable Crypto" ON) +option(POCO_ENABLE_DATA "Enable Data" ON) +option(POCO_ENABLE_DATA_SQLITE "Enable Data SQlite" OFF) +option(POCO_ENABLE_DATA_MYSQL "Enable Data MySQL" OFF) +option(POCO_ENABLE_DATA_ODBC "Enable Data ODBC" ON) +option(POCO_ENABLE_SEVENZIP "Enable SevenZip" OFF) +option(POCO_ENABLE_ZIP "Enable Zip" ON) +option(POCO_ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF) +option(POCO_ENABLE_CPPPARSER "Enable C++ parser" OFF) +option(POCO_ENABLE_POCODOC "Enable Poco Documentation Generator" OFF) +option(POCO_ENABLE_PAGECOMPILER "Enable PageCompiler" ON) +option(POCO_ENABLE_PAGECOMPILER_FILE2PAGE "Enable File2Page" ON) option(FORCE_OPENSSL "Force usage of OpenSSL even under windows" OFF) -option(ENABLE_TESTS +option(POCO_ENABLE_TESTS "Set to OFF|ON (default is OFF) to control build of POCO tests & samples" OFF) option(POCO_STATIC @@ -110,7 +110,7 @@ else (POCO_STATIC) message(STATUS "Building dynamic libraries") endif (POCO_STATIC) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) include(CTest) enable_testing() message(STATUS "Building with unittests & samples") @@ -183,32 +183,32 @@ endif (ANDROID) # Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file set (Poco_COMPONENTS "") -#if (ENABLE_TESTS) -# add_subdirectory (CppUnit) -#endif () +if (POCO_ENABLE_TESTS) + add_subdirectory (CppUnit) +endif () add_subdirectory (Foundation) -if (ENABLE_XML) +if (POCO_ENABLE_XML) add_subdirectory (XML) list (APPEND Poco_COMPONENTS "XML") endif () -if (ENABLE_JSON) +if (POCO_ENABLE_JSON) add_subdirectory (JSON) list (APPEND Poco_COMPONENTS "JSON") endif () -if (ENABLE_MONGODB) +if (POCO_ENABLE_MONGODB) add_subdirectory (MongoDB) list (APPEND Poco_COMPONENTS "MongoDB") endif () -if (ENABLE_PDF) +if (POCO_ENABLE_PDF) add_subdirectory (PDF) list (APPEND Poco_COMPONENTS "PDF") endif() -if (ENABLE_UTIL) +if (POCO_ENABLE_UTIL) add_subdirectory (Util) list (APPEND Poco_COMPONENTS "Util") endif () -if (ENABLE_NET) +if (POCO_ENABLE_NET) add_subdirectory (Net) list (APPEND Poco_COMPONENTS "Net") endif () @@ -217,33 +217,33 @@ endif () #NetSSL -if(WIN32 AND ENABLE_NETSSL_WIN) +if(WIN32 AND POCO_ENABLE_NETSSL_WIN) add_subdirectory(NetSSL_Win) list(APPEND Poco_COMPONENTS "NetSSL_Win") -endif(WIN32 AND ENABLE_NETSSL_WIN) +endif(WIN32 AND POCO_ENABLE_NETSSL_WIN) find_package(OpenSSL) if(OPENSSL_FOUND) include_directories("${OPENSSL_INCLUDE_DIR}") - if(ENABLE_NETSSL) + if(POCO_ENABLE_NETSSL) add_subdirectory(NetSSL_OpenSSL) list(APPEND Poco_COMPONENTS "NetSSL_OpenSSL") endif() - if(ENABLE_CRYPTO) + if(POCO_ENABLE_CRYPTO) add_subdirectory(Crypto) list(APPEND Poco_COMPONENTS "Crypto") endif() endif(OPENSSL_FOUND) -if(ENABLE_DATA) +if(POCO_ENABLE_DATA) add_subdirectory(Data) list(APPEND Poco_COMPONENTS "Data") endif() -if(ENABLE_SEVENZIP) +if(POCO_ENABLE_SEVENZIP) add_subdirectory(SevenZip) list(APPEND Poco_COMPONENTS "SevenZip") endif() -if(ENABLE_ZIP) +if(POCO_ENABLE_ZIP) add_subdirectory(Zip) list(APPEND Poco_COMPONENTS "Zip") endif() @@ -252,28 +252,28 @@ find_package(APR) find_package(Apache2) if(APRUTIL_FOUND AND APACHE_FOUND) include_directories( "${APACHE_INCLUDE_DIR}" "${APRUTIL_INCLUDE_DIR}" ) - if(ENABLE_APACHECONNECTOR) + if(POCO_ENABLE_APACHECONNECTOR) add_subdirectory(ApacheConnector) list(APPEND Poco_COMPONENTS "ApacheConnector") endif() endif(APRUTIL_FOUND AND APACHE_FOUND) -if(ENABLE_CPPPARSER) +if(POCO_ENABLE_CPPPARSER) add_subdirectory(CppParser) list(APPEND Poco_COMPONENTS "CppParser") endif() -if(ENABLE_POCODOC) +if(POCO_ENABLE_POCODOC) add_subdirectory(PocoDoc) list(APPEND Poco_COMPONENTS "PocoDoc") endif() -if(ENABLE_PAGECOMPILER) +if(POCO_ENABLE_PAGECOMPILER) add_subdirectory(PageCompiler) list(APPEND Poco_COMPONENTS "PageCompiler") endif() -if(ENABLE_PAGECOMPILER_FILE2PAGE) +if(POCO_ENABLE_PAGECOMPILER_FILE2PAGE) add_subdirectory(PageCompiler/File2Page) list(APPEND Poco_COMPONENTS "File2Page") endif() diff --git a/contrib/libpoco/Crypto/CMakeLists.txt b/contrib/libpoco/Crypto/CMakeLists.txt index f69f9e9ce30..84b914893ea 100644 --- a/contrib/libpoco/Crypto/CMakeLists.txt +++ b/contrib/libpoco/Crypto/CMakeLists.txt @@ -21,7 +21,7 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" PocoFoundation ${OPENSSL_LIBRARIES} ) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/Data/CMakeLists.txt b/contrib/libpoco/Data/CMakeLists.txt index a997f58d4c4..e8dbfcb18c4 100644 --- a/contrib/libpoco/Data/CMakeLists.txt +++ b/contrib/libpoco/Data/CMakeLists.txt @@ -28,7 +28,7 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" PocoFoundation) -if(ENABLE_DATA_MYSQL) +if(POCO_ENABLE_DATA_MYSQL) find_package(MySQL) if(MYSQL_FOUND) include_directories("${MYSQL_INCLUDE_DIR}") @@ -37,9 +37,9 @@ if(ENABLE_DATA_MYSQL) else() message(STATUS "MySQL Support Disabled - no MySQL library") endif(MYSQL_FOUND) -endif(ENABLE_DATA_MYSQL) +endif(POCO_ENABLE_DATA_MYSQL) -if(ENABLE_DATA_ODBC) +if(POCO_ENABLE_DATA_ODBC) find_package(ODBC) if(WIN32 AND NOT WINCE) set(ODBC_LIBRARIES "odbc32" "odbccp32") @@ -54,9 +54,9 @@ if(ENABLE_DATA_ODBC) message(STATUS "ODBC Support Disabled - no ODBC runtime") endif() endif(WIN32 AND NOT WINCE) -endif(ENABLE_DATA_ODBC) +endif(POCO_ENABLE_DATA_ODBC) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/Data/MySQL/CMakeLists.txt b/contrib/libpoco/Data/MySQL/CMakeLists.txt index 899eb3e5623..8b7f84db097 100644 --- a/contrib/libpoco/Data/MySQL/CMakeLists.txt +++ b/contrib/libpoco/Data/MySQL/CMakeLists.txt @@ -21,6 +21,6 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" PocoFoundation PocoData ${MYSQL_LIB}) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/Data/ODBC/CMakeLists.txt b/contrib/libpoco/Data/ODBC/CMakeLists.txt index 92effcd09a7..83943722ab2 100644 --- a/contrib/libpoco/Data/ODBC/CMakeLists.txt +++ b/contrib/libpoco/Data/ODBC/CMakeLists.txt @@ -21,6 +21,6 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" PocoFoundation PocoData ${ODBC_LIBRARIES}) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/Foundation/CMakeLists.txt b/contrib/libpoco/Foundation/CMakeLists.txt index c6f83570111..2bf2d979197 100644 --- a/contrib/libpoco/Foundation/CMakeLists.txt +++ b/contrib/libpoco/Foundation/CMakeLists.txt @@ -114,7 +114,7 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" ${SYSLIBS}) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory( samples ) add_subdirectory( testsuite ) endif () diff --git a/contrib/libpoco/JSON/CMakeLists.txt b/contrib/libpoco/JSON/CMakeLists.txt index a70ad18925e..d2b0c8b36f5 100644 --- a/contrib/libpoco/JSON/CMakeLists.txt +++ b/contrib/libpoco/JSON/CMakeLists.txt @@ -19,7 +19,7 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" PocoFoundation) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/MongoDB/CMakeLists.txt b/contrib/libpoco/MongoDB/CMakeLists.txt index 9c1a01e677a..2593c4c9a6f 100644 --- a/contrib/libpoco/MongoDB/CMakeLists.txt +++ b/contrib/libpoco/MongoDB/CMakeLists.txt @@ -19,7 +19,7 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" PocoNet PocoFoundation) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/Net/CMakeLists.txt b/contrib/libpoco/Net/CMakeLists.txt index de9e61873a9..2b791069894 100644 --- a/contrib/libpoco/Net/CMakeLists.txt +++ b/contrib/libpoco/Net/CMakeLists.txt @@ -30,7 +30,7 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" PocoFoundation ${SYSLIBS}) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/NetSSL_OpenSSL/CMakeLists.txt b/contrib/libpoco/NetSSL_OpenSSL/CMakeLists.txt index 8ad82db691f..3dee666152b 100644 --- a/contrib/libpoco/NetSSL_OpenSSL/CMakeLists.txt +++ b/contrib/libpoco/NetSSL_OpenSSL/CMakeLists.txt @@ -19,7 +19,7 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" PocoCrypto PocoNet PocoUtil PocoFoundation ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/Util/CMakeLists.txt b/contrib/libpoco/Util/CMakeLists.txt index 6742f989720..6c3b6fc5c50 100644 --- a/contrib/libpoco/Util/CMakeLists.txt +++ b/contrib/libpoco/Util/CMakeLists.txt @@ -24,18 +24,18 @@ set_target_properties( "${LIBNAME}" ) target_link_libraries( "${LIBNAME}" PocoFoundation) -if (ENABLE_XML) +if (POCO_ENABLE_XML) target_link_libraries( "${LIBNAME}" PocoXML) else () add_definitions( -DPOCO_UTIL_NO_XMLCONFIGURATION ) endif() -if (ENABLE_JSON) +if (POCO_ENABLE_JSON) target_link_libraries( "${LIBNAME}" PocoJSON) else () add_definitions( -DPOCO_UTIL_NO_JSONCONFIGURATION ) endif() -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/XML/CMakeLists.txt b/contrib/libpoco/XML/CMakeLists.txt index 1bf380089cc..7acadb10004 100644 --- a/contrib/libpoco/XML/CMakeLists.txt +++ b/contrib/libpoco/XML/CMakeLists.txt @@ -42,7 +42,7 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" ${SYSLIBS} PocoFoundation) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/contrib/libpoco/Zip/CMakeLists.txt b/contrib/libpoco/Zip/CMakeLists.txt index 9ce7c5ca115..bd372839f66 100644 --- a/contrib/libpoco/Zip/CMakeLists.txt +++ b/contrib/libpoco/Zip/CMakeLists.txt @@ -19,7 +19,7 @@ set_target_properties( "${LIBNAME}" target_link_libraries( "${LIBNAME}" PocoUtil PocoXML PocoFoundation) -if (ENABLE_TESTS) +if (POCO_ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/doc/build.md b/doc/build.md index d831205ce17..fcbea117f1c 100644 --- a/doc/build.md +++ b/doc/build.md @@ -111,7 +111,7 @@ This is rarely used but enabled by default. If you don't need it, you could set variable and skip installation step: ``` -export DISABLE_MONGODB=1 +export ENABLE_MONGODB=0 ``` Otherwise: diff --git a/doc/build_osx.md b/doc/build_osx.md index 96a15f9302e..548d526fd6b 100644 --- a/doc/build_osx.md +++ b/doc/build_osx.md @@ -54,7 +54,7 @@ export CXX=g++-6 ## Disable MongoDB binding ``` -export DISABLE_MONGODB=1 +export ENABLE_MONGODB=0 ``` ## Detect number of threads diff --git a/doc/getting_started/getting_started_en.md b/doc/getting_started/getting_started_en.md index 96ffc467a2b..42a810f40f9 100644 --- a/doc/getting_started/getting_started_en.md +++ b/doc/getting_started/getting_started_en.md @@ -33,7 +33,7 @@ https://github.com/yandex/ClickHouse/blob/master/doc/build.md Install required packages. After that let's run the following command from directory with source code of ClickHouse: ``` -~/ClickHouse$ DISABLE_MONGODB=1 ./release --standalone +~/ClickHouse$ ENABLE_MONGODB=0 ./release --standalone ``` The build successfully completed: diff --git a/doc/getting_started/getting_started_ru.md b/doc/getting_started/getting_started_ru.md index 785c04f5398..69cce63ea5b 100644 --- a/doc/getting_started/getting_started_ru.md +++ b/doc/getting_started/getting_started_ru.md @@ -33,7 +33,7 @@ https://github.com/yandex/ClickHouse/blob/master/doc/build.md Установим необходимые пакеты. После этого выполним следующую команду из директории с исходными кодами ClickHouse: ``` -~/ClickHouse$ DISABLE_MONGODB=1 ./release --standalone +~/ClickHouse$ ENABLE_MONGODB=0 ./release --standalone ``` Сборка успешно завершена: diff --git a/libs/libcommon/CMakeLists.txt b/libs/libcommon/CMakeLists.txt index c79b3d37f8a..99b7b15dc4c 100644 --- a/libs/libcommon/CMakeLists.txt +++ b/libs/libcommon/CMakeLists.txt @@ -82,31 +82,7 @@ else () endif () endif () -set (GLIB_HINTS "/usr/local/opt/glib/lib") -if (USE_STATIC_LIBRARIES) - find_library (GLIB_LIB libglib-2.0.a HINTS ${GLIB_HINTS}) -else () - find_library (GLIB_LIB glib-2.0 HINTS ${GLIB_HINTS}) -endif () -if (APPLE) - set (INTL_HINTS "/usr/local/opt/gettext/lib") - if (USE_STATIC_LIBRARIES) - find_library (INTL_LIB libintl.a HINTS ${INTL_HINTS}) - else () - find_library (INTL_LIB intl HINTS ${INTL_HINTS}) - endif () - set (ICONV_HINTS "/usr/local/opt/libiconv/lib") - if (USE_STATIC_LIBRARIES) - find_library (ICONV_LIB libiconv.a HINTS ${ICONV_HINTS}) - else () - find_library (ICONV_LIB iconv HINTS ${ICONV_HINTS}) - endif () - find_library (CORE_FOUNDATION_LIB CoreFoundation) - find_library (CARBON_LIB Carbon) - set (GLIB_LIBS ${GLIB_LIB} ${INTL_LIB} ${ICONV_LIB} ${CORE_FOUNDATION_LIB} ${CARBON_LIB}) -else (APPLE) - set (GLIB_LIBS ${GLIB_LIB}) -endif (APPLE) +include (${ClickHouse_SOURCE_DIR}/cmake/find_glib.cmake) target_link_libraries ( common diff --git a/libs/libmysqlxx/CMakeLists.txt b/libs/libmysqlxx/CMakeLists.txt index a44751bef28..6270092e617 100644 --- a/libs/libmysqlxx/CMakeLists.txt +++ b/libs/libmysqlxx/CMakeLists.txt @@ -26,13 +26,6 @@ add_library (mysqlxx add_dependencies (mysqlxx common) -set (MYSQL_HINTS "/usr/local/opt/mysql/lib") -if (USE_STATIC_LIBRARIES) - find_library (STATIC_MYSQLCLIENT_LIB libmysqlclient.a HINTS ${MYSQL_HINTS}) -else () - find_library (MYSQLCLIENT_LIB mysqlclient HINTS ${MYSQL_HINTS}) -endif () - set (Z_HINTS "/usr/local/opt/zlib/lib") if (USE_STATIC_LIBRARIES) find_library (Z_LIB libz.a HINTS ${Z_HINTS}) @@ -43,13 +36,13 @@ endif () if (USE_STATIC_LIBRARIES) set (MYSQLCLIENT_LIB ${CMAKE_CURRENT_BINARY_DIR}/libmysqlclient.a) target_link_libraries (mysqlxx common ${MYSQLCLIENT_LIB} ${OPENSSL_LIBRARIES} ${Z_LIB} dl) - add_custom_command( + add_custom_command ( OUTPUT ${MYSQLCLIENT_LIB} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/patch.sh ${STATIC_MYSQLCLIENT_LIB} ${MYSQLCLIENT_LIB} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Patching mysqlclient library.") - add_custom_target(our_mysql_client DEPENDS ${MYSQLCLIENT_LIB}) - add_dependencies(mysqlxx our_mysql_client) + add_custom_target (our_mysql_client DEPENDS ${MYSQLCLIENT_LIB}) + add_dependencies (mysqlxx our_mysql_client) endif () target_link_libraries (mysqlxx common ${MYSQLCLIENT_LIB} ${OPENSSL_LIBRARIES} ${Z_LIB} dl) diff --git a/libs/libmysqlxx/include/mysqlxx/Exception.h b/libs/libmysqlxx/include/mysqlxx/Exception.h index ab21cca95b0..73891b20f17 100644 --- a/libs/libmysqlxx/include/mysqlxx/Exception.h +++ b/libs/libmysqlxx/include/mysqlxx/Exception.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include diff --git a/libs/libmysqlxx/include/mysqlxx/Pool.h b/libs/libmysqlxx/include/mysqlxx/Pool.h index 9ebcb1063b1..29eb7e60f46 100644 --- a/libs/libmysqlxx/include/mysqlxx/Pool.h +++ b/libs/libmysqlxx/include/mysqlxx/Pool.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/libs/libmysqlxx/include/mysqlxx/Types.h b/libs/libmysqlxx/include/mysqlxx/Types.h index b887c527ca8..05830963224 100644 --- a/libs/libmysqlxx/include/mysqlxx/Types.h +++ b/libs/libmysqlxx/include/mysqlxx/Types.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include #include diff --git a/libs/libmysqlxx/src/tests/CMakeLists.txt b/libs/libmysqlxx/src/tests/CMakeLists.txt index 827ef651868..6bc78c4a70b 100644 --- a/libs/libmysqlxx/src/tests/CMakeLists.txt +++ b/libs/libmysqlxx/src/tests/CMakeLists.txt @@ -4,9 +4,9 @@ add_executable (mysqlxx_test mysqlxx_test.cpp) add_executable (failover failover.cpp) if (APPLE) - SET(RT_LIBRARIES "") + set (RT_LIBRARIES "") else() - SET(RT_LIBRARIES "rt") + set (RT_LIBRARIES "rt") endif() target_link_libraries (mysqlxx_test mysqlxx dbms ${RT_LIBRARIES}) -target_link_libraries (failover mysqlxx PocoUtil PocoFoundation) +target_link_libraries (failover mysqlxx PocoUtil PocoFoundation ${RT_LIBRARIES}) diff --git a/release b/release index f9dfecfa182..58ead26da74 100755 --- a/release +++ b/release @@ -51,7 +51,7 @@ make_control "$CONTROL" "$DAEMONS" gen_changelog "$REVISION" "$CHDATE" "$AUTHOR" "$CHLOG" "$DAEMONS" # Build (only binary packages). -debuild -e DAEMONS="${DAEMONS}" -e DISABLE_MONGODB -e GLIBC_COMPATIBILITY -e CC -e CXX -b ${DEBUILD_NOSIGN_OPTIONS} +debuild -e DAEMONS="${DAEMONS}" -e ENABLE_MONGODB -e GLIBC_COMPATIBILITY -e CC -e CXX -b ${DEBUILD_NOSIGN_OPTIONS} if [[ $STANDALONE != 'yes' ]] then