ClickHouse/base/base/CMakeLists.txt
Azat Khuzhin b7f92454bf Move LineReader/ReplxxLineReader out from base
This will simplify linking dependencies, and anyway this classes are not
base in any sense.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-12-27 14:23:51 +01:00

64 lines
1.8 KiB
CMake

set (SRCS
argsToConfig.cpp
coverage.cpp
demangle.cpp
getAvailableMemoryAmount.cpp
getFQDNOrHostName.cpp
getMemoryAmount.cpp
getPageSize.cpp
getThreadId.cpp
JSON.cpp
mremap.cpp
phdr_cache.cpp
preciseExp10.cpp
shift10.cpp
sleep.cpp
terminalColors.cpp
errnoToString.cpp
StringRef.cpp
safeExit.cpp
throwError.cpp
)
if (USE_DEBUG_HELPERS)
get_target_property(MAGIC_ENUM_INCLUDE_DIR ch_contrib::magic_enum INTERFACE_INCLUDE_DIRECTORIES)
# CMake generator expression will do insane quoting when it encounters special character like quotes, spaces, etc.
# Prefixing "SHELL:" will force it to use the original text.
set (INCLUDE_DEBUG_HELPERS "SHELL:-I\"${MAGIC_ENUM_INCLUDE_DIR}\" -include \"${ClickHouse_SOURCE_DIR}/base/base/iostream_debug_helpers.h\"")
# Use generator expression as we don't want to pollute CMAKE_CXX_FLAGS, which will interfere with CMake check system.
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${INCLUDE_DEBUG_HELPERS}>)
endif ()
add_library (common ${SRCS})
if (WITH_COVERAGE)
target_compile_definitions(common PUBLIC WITH_COVERAGE=1)
else ()
target_compile_definitions(common PUBLIC WITH_COVERAGE=0)
endif ()
target_include_directories(common PUBLIC .. "${CMAKE_CURRENT_BINARY_DIR}/..")
if (OS_DARWIN AND NOT USE_STATIC_LIBRARIES)
target_link_libraries(common PUBLIC -Wl,-U,_inside_main)
endif()
target_link_libraries (common
PUBLIC
ch_contrib::cityhash
boost::headers_only
boost::system
Poco::Net
Poco::Net::SSL
Poco::Util
Poco::Foundation
ch_contrib::replxx
ch_contrib::cctz
ch_contrib::fmt
ch_contrib::magic_enum
)
if (ENABLE_TESTS)
add_subdirectory (tests)
endif ()