ClickHouse/libs/libcommon/CMakeLists.txt

133 lines
3.9 KiB
CMake
Raw Normal View History

set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/include/common/config_common.h)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/common/config_common.h.in ${CONFIG_COMMON})
add_library(apple_rt
src/apple_rt.cpp
include/port/clock.h
)
target_include_directories (apple_rt PUBLIC ${COMMON_INCLUDE_DIR})
2018-07-20 16:56:39 +00:00
if (DEFINED APPLE_HAVE_CLOCK_GETTIME)
target_compile_definitions(apple_rt PUBLIC -DAPPLE_HAVE_CLOCK_GETTIME=${APPLE_HAVE_CLOCK_GETTIME})
endif ()
add_library (common
src/DateLUT.cpp
src/DateLUTImpl.cpp
src/preciseExp10.c
2018-01-13 18:01:31 +00:00
src/shift10.cpp
src/mremap.cpp
src/JSON.cpp
src/getMemoryAmount.cpp
src/demangle.cpp
2019-02-02 00:25:12 +00:00
src/setTerminalEcho.cpp
src/getThreadNumber.cpp
2019-07-10 20:47:39 +00:00
src/sleep.cpp
src/argsToConfig.cpp
2019-07-10 20:47:39 +00:00
src/Pipe.cpp
src/phdr_cache.cpp
2016-02-07 21:58:58 +00:00
2019-06-28 18:06:38 +00:00
include/common/SimpleCache.h
2017-04-16 05:40:17 +00:00
include/common/Types.h
include/common/DayNum.h
include/common/DateLUT.h
include/common/DateLUTImpl.h
include/common/LocalDate.h
include/common/LocalDateTime.h
include/common/ErrorHandlers.h
include/common/preciseExp10.h
2018-01-13 18:01:31 +00:00
include/common/shift10.h
include/common/mremap.h
include/common/likely.h
include/common/logger_useful.h
include/common/strong_typedef.h
include/common/JSON.h
include/common/getMemoryAmount.h
include/common/demangle.h
2019-02-02 00:25:12 +00:00
include/common/setTerminalEcho.h
include/common/find_symbols.h
include/common/constexpr_helpers.h
include/common/Pipe.h
include/common/getThreadNumber.h
2019-07-10 20:47:39 +00:00
include/common/sleep.h
2019-05-30 10:30:24 +00:00
include/common/SimpleCache.h
include/common/phdr_cache.h
2016-02-07 21:58:58 +00:00
2017-06-07 01:48:22 +00:00
include/ext/bit_cast.h
include/ext/collection_cast.h
include/ext/enumerate.h
include/ext/function_traits.h
include/ext/identity.h
include/ext/map.h
include/ext/range.h
include/ext/scope_guard.h
include/ext/size.h
include/ext/unlock_guard.h
2016-02-07 21:58:58 +00:00
2019-07-05 13:48:47 +00:00
${CONFIG_COMMON})
2016-02-07 21:58:58 +00:00
# When testing for memory leaks with Valgrind, dont link tcmalloc or jemalloc.
if (USE_JEMALLOC)
message (STATUS "Link jemalloc: ${JEMALLOC_LIBRARIES}")
set (MALLOC_LIBRARIES ${JEMALLOC_LIBRARIES})
elseif (USE_TCMALLOC)
2018-01-15 11:59:00 +00:00
if (DEBUG_TCMALLOC AND NOT GPERFTOOLS_TCMALLOC_MINIMAL_DEBUG)
message (FATAL_ERROR "Requested DEBUG_TCMALLOC but debug library is not found. You should install Google Perftools. Example: sudo apt-get install libgoogle-perftools-dev")
2018-01-15 11:59:00 +00:00
endif ()
if (DEBUG_TCMALLOC AND GPERFTOOLS_TCMALLOC_MINIMAL_DEBUG)
message (STATUS "Link libtcmalloc_minimal_debug for testing: ${GPERFTOOLS_TCMALLOC_MINIMAL_DEBUG}")
set (MALLOC_LIBRARIES ${GPERFTOOLS_TCMALLOC_MINIMAL_DEBUG})
else ()
message (STATUS "Link libtcmalloc_minimal: ${GPERFTOOLS_TCMALLOC_MINIMAL}")
set (MALLOC_LIBRARIES ${GPERFTOOLS_TCMALLOC_MINIMAL})
endif ()
elseif (SANITIZE)
message (STATUS "Will use ${SANITIZE} sanitizer.")
2019-09-04 15:17:18 +00:00
elseif (OS_LINUX)
message (WARNING "Non default allocator is disabled. This is not recommended for production Linux builds.")
2016-12-01 22:44:59 +00:00
endif ()
2016-02-07 21:58:58 +00:00
if (USE_INTERNAL_MEMCPY)
set (MEMCPY_LIBRARIES memcpy)
endif ()
2017-01-11 13:40:02 +00:00
find_package (Threads)
2019-05-15 17:19:39 +00:00
if(CCTZ_INCLUDE_DIR)
target_include_directories(common BEFORE PRIVATE ${CCTZ_INCLUDE_DIR})
endif()
target_include_directories (common PUBLIC ${COMMON_INCLUDE_DIR})
if (NOT USE_INTERNAL_BOOST_LIBRARY)
2019-04-23 12:51:27 +00:00
target_include_directories (common SYSTEM BEFORE PUBLIC ${Boost_INCLUDE_DIRS})
endif ()
2019-04-23 12:51:27 +00:00
if(NOT USE_INTERNAL_POCO_LIBRARY)
target_include_directories (common SYSTEM BEFORE PUBLIC ${Poco_Foundation_INCLUDE_DIR})
endif()
2019-05-15 17:19:39 +00:00
if(CCTZ_LIBRARY)
target_link_libraries(common PRIVATE ${CCTZ_LIBRARY})
endif()
target_link_libraries (common
PUBLIC
${Poco_Util_LIBRARY}
${Poco_Foundation_LIBRARY}
${CITYHASH_LIBRARIES}
PUBLIC
2018-08-21 23:57:59 +00:00
${Boost_SYSTEM_LIBRARY}
PRIVATE
${MALLOC_LIBRARIES}
2019-07-05 13:48:47 +00:00
${MEMCPY_LIBRARIES})
2016-05-28 00:16:28 +00:00
if (RT_LIBRARY)
target_link_libraries (common PRIVATE ${RT_LIBRARY})
endif ()
2016-12-01 22:44:59 +00:00
if (ENABLE_TESTS)
add_subdirectory (src/tests)
endif ()