2020-02-16 08:04:03 +00:00
|
|
|
set (SRCS
|
2020-02-14 14:48:30 +00:00
|
|
|
argsToConfig.cpp
|
|
|
|
coverage.cpp
|
|
|
|
DateLUT.cpp
|
|
|
|
DateLUTImpl.cpp
|
|
|
|
demangle.cpp
|
2020-03-18 18:54:27 +00:00
|
|
|
getFQDNOrHostName.cpp
|
2020-02-14 14:48:30 +00:00
|
|
|
getMemoryAmount.cpp
|
|
|
|
getThreadId.cpp
|
|
|
|
JSON.cpp
|
|
|
|
LineReader.cpp
|
|
|
|
mremap.cpp
|
|
|
|
phdr_cache.cpp
|
2020-05-08 14:11:19 +00:00
|
|
|
preciseExp10.cpp
|
2020-02-14 14:48:30 +00:00
|
|
|
setTerminalEcho.cpp
|
|
|
|
shift10.cpp
|
|
|
|
sleep.cpp
|
2020-02-21 20:01:38 +00:00
|
|
|
terminalColors.cpp
|
2020-06-07 17:29:34 +00:00
|
|
|
errnoToString.cpp
|
2020-02-14 14:48:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if (ENABLE_REPLXX)
|
2020-03-18 18:54:27 +00:00
|
|
|
list (APPEND SRCS ReplxxLineReader.cpp)
|
2020-02-25 08:30:11 +00:00
|
|
|
elseif (ENABLE_READLINE)
|
2020-03-18 18:54:27 +00:00
|
|
|
list (APPEND SRCS ReadlineLineReader.cpp)
|
2020-02-14 14:48:30 +00:00
|
|
|
endif ()
|
|
|
|
|
2020-02-24 00:44:38 +00:00
|
|
|
if (USE_DEBUG_HELPERS)
|
|
|
|
set (INCLUDE_DEBUG_HELPERS "-include ${ClickHouse_SOURCE_DIR}/base/common/iostream_debug_helpers.h")
|
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${INCLUDE_DEBUG_HELPERS}")
|
|
|
|
endif ()
|
|
|
|
|
2020-02-16 08:04:03 +00:00
|
|
|
add_library (common ${SRCS})
|
|
|
|
|
2020-03-18 18:54:27 +00:00
|
|
|
if (WITH_COVERAGE)
|
|
|
|
target_compile_definitions(common PUBLIC WITH_COVERAGE=1)
|
|
|
|
else ()
|
|
|
|
target_compile_definitions(common PUBLIC WITH_COVERAGE=0)
|
|
|
|
endif ()
|
|
|
|
|
2020-04-22 22:18:52 +00:00
|
|
|
if (USE_INTERNAL_CCTZ)
|
|
|
|
set_source_files_properties(DateLUTImpl.cpp PROPERTIES COMPILE_DEFINITIONS USE_INTERNAL_CCTZ)
|
|
|
|
endif()
|
|
|
|
|
2020-02-16 08:04:03 +00:00
|
|
|
target_include_directories(common PUBLIC .. ${CMAKE_CURRENT_BINARY_DIR}/..)
|
2020-02-14 14:48:30 +00:00
|
|
|
|
|
|
|
if (NOT USE_INTERNAL_BOOST_LIBRARY)
|
|
|
|
target_include_directories (common SYSTEM BEFORE PUBLIC ${Boost_INCLUDE_DIRS})
|
|
|
|
endif ()
|
|
|
|
|
2020-05-08 14:11:19 +00:00
|
|
|
# Allow explicit fallback to readline
|
2020-02-25 08:30:11 +00:00
|
|
|
if (NOT ENABLE_REPLXX AND ENABLE_READLINE)
|
|
|
|
message (STATUS "Attempt to fallback to readline explicitly")
|
|
|
|
set (READLINE_PATHS "/usr/local/opt/readline/lib")
|
|
|
|
# First try find custom lib for macos users (default lib without history support)
|
|
|
|
find_library (READLINE_LIB NAMES readline PATHS ${READLINE_PATHS} NO_DEFAULT_PATH)
|
|
|
|
if (NOT READLINE_LIB)
|
|
|
|
find_library (READLINE_LIB NAMES readline PATHS ${READLINE_PATHS})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set(READLINE_INCLUDE_PATHS "/usr/local/opt/readline/include")
|
|
|
|
find_path (READLINE_INCLUDE_DIR NAMES readline/readline.h PATHS ${READLINE_INCLUDE_PATHS} NO_DEFAULT_PATH)
|
|
|
|
if (NOT READLINE_INCLUDE_DIR)
|
|
|
|
find_path (READLINE_INCLUDE_DIR NAMES readline/readline.h PATHS ${READLINE_INCLUDE_PATHS})
|
|
|
|
endif ()
|
|
|
|
if (READLINE_INCLUDE_DIR AND READLINE_LIB)
|
|
|
|
target_link_libraries(common PUBLIC ${READLINE_LIB})
|
|
|
|
target_compile_definitions(common PUBLIC USE_READLINE=1)
|
|
|
|
message (STATUS "Using readline: ${READLINE_INCLUDE_DIR} : ${READLINE_LIB}")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
2020-02-14 14:48:30 +00:00
|
|
|
target_link_libraries (common
|
2020-02-16 08:04:03 +00:00
|
|
|
PUBLIC
|
|
|
|
${CITYHASH_LIBRARIES}
|
|
|
|
${Boost_SYSTEM_LIBRARY}
|
2020-03-12 22:26:16 +00:00
|
|
|
FastMemcpy
|
2020-05-08 14:11:19 +00:00
|
|
|
Poco::Net
|
|
|
|
Poco::Net::SSL
|
|
|
|
Poco::Util
|
2020-05-08 20:10:59 +00:00
|
|
|
Poco::Foundation
|
2020-03-18 18:54:27 +00:00
|
|
|
replxx
|
2020-05-22 10:58:29 +00:00
|
|
|
fmt
|
2020-03-19 10:38:34 +00:00
|
|
|
|
|
|
|
PRIVATE
|
|
|
|
cctz
|
2020-02-16 08:04:03 +00:00
|
|
|
)
|
2020-02-14 14:48:30 +00:00
|
|
|
|
|
|
|
if (ENABLE_TESTS)
|
|
|
|
add_subdirectory (tests)
|
|
|
|
endif ()
|