@@ -36,20 +36,18 @@ IF (WITH_OPENSSL)
36
36
LIST (APPEND clickhouse-cpp-lib-src base/sslsocket.cpp)
37
37
ENDIF ()
38
38
39
- ADD_LIBRARY (clickhouse-cpp-lib SHARED ${clickhouse-cpp-lib-src})
40
- SET_TARGET_PROPERTIES (clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX)
39
+ ADD_LIBRARY (clickhouse-cpp-lib ${clickhouse-cpp-lib-src})
40
+ SET_TARGET_PROPERTIES (clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX)
41
41
TARGET_LINK_LIBRARIES (clickhouse-cpp-lib
42
42
absl-lib
43
43
cityhash-lib
44
44
lz4-lib
45
45
)
46
46
47
- ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src})
48
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static
49
- absl-lib
50
- cityhash-lib
51
- lz4-lib
52
- )
47
+ IF (NOT BUILD_SHARED_LIBS )
48
+ ADD_LIBRARY (clickhouse-cpp-lib-static ALIAS clickhouse-cpp-lib)
49
+ ENDIF ()
50
+
53
51
54
52
IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
55
53
INCLUDE (CheckCXXSourceCompiles)
@@ -68,17 +66,20 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
68
66
# /usr/bin/ld: CMakeFiles/simple-test.dir/main.cpp.o: undefined reference to symbol '_Unwind_Resume@@GCC_3.0'
69
67
# /usr/bin/ld: /lib/x86_64-linux-gnu/libgcc_s.so.1: error adding symbols: DSO missing from command line
70
68
# FIXME: that workaround breaks clang build on mingw
71
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib gcc_s)
72
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static gcc_s)
69
+ IF (BUILD_SHARED_LIBS )
70
+ TARGET_LINK_LIBRARIES (clickhouse-cpp-lib gcc_s)
71
+ ELSE ()
72
+ TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static gcc_s)
73
+ ENDIF ()
73
74
ENDIF ()
74
75
ENDIF ()
75
76
76
- INSTALL (TARGETS clickhouse-cpp-lib clickhouse-cpp-lib-static
77
+
78
+ INSTALL (TARGETS clickhouse-cpp-lib
77
79
ARCHIVE DESTINATION lib
78
80
LIBRARY DESTINATION lib
79
81
)
80
82
81
-
82
83
# general
83
84
INSTALL (FILES block.h DESTINATION include /clickhouse/)
84
85
INSTALL (FILES client.h DESTINATION include /clickhouse/)
@@ -124,10 +125,8 @@ INSTALL(FILES types/types.h DESTINATION include/clickhouse/types/)
124
125
125
126
IF (WITH_OPENSSL)
126
127
TARGET_LINK_LIBRARIES (clickhouse-cpp-lib OpenSSL::SSL)
127
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static OpenSSL::SSL)
128
128
ENDIF ()
129
129
130
130
IF (WIN32 OR MINGW)
131
131
TARGET_LINK_LIBRARIES (clickhouse-cpp-lib wsock32 ws2_32)
132
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static wsock32 ws2_32)
133
132
ENDIF ()
0 commit comments