CMakeLists.txt 2.5 KB
Newer Older
A
Alexey Milovidov 已提交
1 2 3 4
SET(REVISIONFILE ${CMAKE_CURRENT_BINARY_DIR}/src/revision.h)

ADD_CUSTOM_COMMAND(
    OUTPUT ${REVISIONFILE}
P
Merge  
Pavel Kartavyy 已提交
5
    COMMAND bash -f -v -x ${CMAKE_CURRENT_SOURCE_DIR}/src/create_revision.sh ${REVISIONFILE} ${USE_DBMS_TCP_PROTOCOL_VERSION_AS_CLICKHOUSE_REVISION}
A
Alexey Milovidov 已提交
6 7 8
)

set_source_files_properties(
9
	src/ClickHouseRevision.cpp PROPERTIES OBJECT_DEPENDS ${REVISIONFILE}
A
Alexey Milovidov 已提交
10 11 12 13
)

include_directories (${CMAKE_CURRENT_BINARY_DIR}/src/)

V
Vladimir Smirnov 已提交
14
if (APPLE)
15 16 17 18 19 20
	if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT "${CMAKE_SYSTEM_VERSION}" VERSION_LESS "16.1.0")
		set (APPLE_SIERRA_OR_NEWER 1)
	else ()
		set (APPLE_SIERRA_OR_NEWER 0)
	endif ()
	configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/common/apple_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/common/apple_version.h)
V
Vladimir Smirnov 已提交
21 22 23 24 25 26
	add_library (apple_rt
		src/apple_rt.cpp
		include/common/apple_rt.h
	)
endif()

A
Alexey Milovidov 已提交
27 28 29
add_library (common
	src/DateLUT.cpp
	src/DateLUTImpl.cpp
30
	src/ClickHouseRevision.cpp
A
Alexey Milovidov 已提交
31 32 33 34 35 36 37 38 39 40 41 42
	src/JSON.cpp

	include/common/ApplicationServerExt.h
	include/common/Common.h
	include/common/DateLUT.h
	include/common/DateLUTImpl.h
	include/common/LocalDate.h
	include/common/LocalDateTime.h
	include/common/ErrorHandlers.h
	include/common/likely.h
	include/common/logger_useful.h
	include/common/MultiVersion.h
43
	include/common/ClickHouseRevision.h
A
Alexey Milovidov 已提交
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
	include/common/singleton.h
	include/common/strong_typedef.h
	include/common/JSON.h

	include/ext/bit_cast.hpp
	include/ext/collection_cast.hpp
	include/ext/enumerate.hpp
	include/ext/function_traits.hpp
	include/ext/identity.hpp
	include/ext/map.hpp
	include/ext/range.hpp
	include/ext/scope_guard.hpp
	include/ext/size.hpp
	include/ext/unlock_guard.hpp

	${REVISIONFILE}
)

# TESTIRT-3687 DISABLE_LIBTCMALLOC - when testing for memory leaks, disable libtcmalloc
IF($ENV{DISABLE_LIBTCMALLOC})
	message(STATUS "Disabling libtcmalloc for valgrind better analysis")
ELSE($ENV{DISABLE_LIBTCMALLOC})
	IF($ENV{DEBUG_LIBTCMALLOC})
		message(STATUS "Link libtcmalloc_minimal_debug for testing")
A
Alexey Milovidov 已提交
68
		SET(MALLOC_LIBRARIES libtcmalloc_minimal_debug.a)
A
Alexey Milovidov 已提交
69 70
	ELSE($ENV{DEBUG_LIBTCMALLOC})
		message(STATUS "Link libtcmalloc_minimal")
A
Alexey Milovidov 已提交
71
		SET(MALLOC_LIBRARIES tcmalloc_minimal_internal)
A
Alexey Milovidov 已提交
72 73 74
	ENDIF($ENV{DEBUG_LIBTCMALLOC})
ENDIF($ENV{DISABLE_LIBTCMALLOC})

V
Vladimir Smirnov 已提交
75 76 77 78 79 80
if (APPLE)
	SET(RT_LIBRARIES "apple_rt")
else()
	SET(RT_LIBRARIES "librt.a")
endif()

81 82 83
set (GLIB_HINTS "/usr/local/opt/glib/lib")
find_library (GLIB_LIB libglib-2.0.a HINTS ${GLIB_HINTS})

A
Alexey Milovidov 已提交
84 85 86 87 88
target_link_libraries (
	common
	pocoext
	${MALLOC_LIBRARIES}
	pthread
89
	${GLIB_LIB}
90
	${ICU_LIBS}
V
Vladimir Smirnov 已提交
91
	${RT_LIBRARIES})
A
Alexey Milovidov 已提交
92

A
Alexey Milovidov 已提交
93 94 95
IF(TESTS)
	add_subdirectory (src/tests)
ENDIF(TESTS)