Skip to content

Commit c1db61b

Browse files
authored
Merge pull request ClickHouse#33946 from azat/build-cleanup
Remove MAKE_STATIC_LIBRARIES (in favor of USE_STATIC_LIBRARIES)
2 parents 189ff60 + 4a0facd commit c1db61b

File tree

12 files changed

+24
-26
lines changed

12 files changed

+24
-26
lines changed

CMakeLists.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
104104
string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
105105

106106
option(USE_STATIC_LIBRARIES "Disable to use shared libraries" ON)
107-
option(MAKE_STATIC_LIBRARIES "Disable to make shared libraries" ${USE_STATIC_LIBRARIES})
108107

109-
if (NOT MAKE_STATIC_LIBRARIES)
108+
if (NOT USE_STATIC_LIBRARIES)
110109
# DEVELOPER ONLY.
111110
# Faster linking if turned on.
112111
option(SPLIT_SHARED_LIBRARIES "Keep all internal libraries as separate .so files")
@@ -115,11 +114,11 @@ if (NOT MAKE_STATIC_LIBRARIES)
115114
"Make several binaries (clickhouse-server, clickhouse-client etc.) instead of one bundled")
116115
endif ()
117116

118-
if (MAKE_STATIC_LIBRARIES AND SPLIT_SHARED_LIBRARIES)
119-
message(FATAL_ERROR "Defining SPLIT_SHARED_LIBRARIES=1 without MAKE_STATIC_LIBRARIES=0 has no effect.")
117+
if (USE_STATIC_LIBRARIES AND SPLIT_SHARED_LIBRARIES)
118+
message(FATAL_ERROR "Defining SPLIT_SHARED_LIBRARIES=1 without USE_STATIC_LIBRARIES=0 has no effect.")
120119
endif()
121120

122-
if (NOT MAKE_STATIC_LIBRARIES AND SPLIT_SHARED_LIBRARIES)
121+
if (NOT USE_STATIC_LIBRARIES AND SPLIT_SHARED_LIBRARIES)
123122
set(BUILD_SHARED_LIBS 1 CACHE INTERNAL "")
124123
endif ()
125124

@@ -201,7 +200,7 @@ endif ()
201200
option(ENABLE_TESTS "Provide unit_test_dbms target with Google.Test unit tests" ON)
202201
option(ENABLE_EXAMPLES "Build all example programs in 'examples' subdirectories" OFF)
203202

204-
if (OS_LINUX AND (ARCH_AMD64 OR ARCH_AARCH64) AND MAKE_STATIC_LIBRARIES AND NOT SPLIT_SHARED_LIBRARIES AND NOT USE_MUSL)
203+
if (OS_LINUX AND (ARCH_AMD64 OR ARCH_AARCH64) AND USE_STATIC_LIBRARIES AND NOT SPLIT_SHARED_LIBRARIES AND NOT USE_MUSL)
205204
# Only for Linux, x86_64 or aarch64.
206205
option(GLIBC_COMPATIBILITY "Enable compatibility with older glibc libraries." ON)
207206
elseif(GLIBC_COMPATIBILITY)
@@ -436,7 +435,7 @@ endif ()
436435

437436
set (CMAKE_POSTFIX_VARIABLE "CMAKE_${CMAKE_BUILD_TYPE_UC}_POSTFIX")
438437

439-
if (MAKE_STATIC_LIBRARIES)
438+
if (USE_STATIC_LIBRARIES)
440439
set (CMAKE_POSITION_INDEPENDENT_CODE OFF)
441440
if (OS_LINUX AND NOT ARCH_ARM)
442441
# Slightly more efficient code can be generated
@@ -472,7 +471,6 @@ endif ()
472471
message (STATUS
473472
"Building for: ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_LIBRARY_ARCHITECTURE} ;
474473
USE_STATIC_LIBRARIES=${USE_STATIC_LIBRARIES}
475-
MAKE_STATIC_LIBRARIES=${MAKE_STATIC_LIBRARIES}
476474
SPLIT_SHARED=${SPLIT_SHARED_LIBRARIES}
477475
CCACHE=${CCACHE_FOUND} ${CCACHE_VERSION}")
478476

@@ -520,7 +518,7 @@ macro (add_executable target)
520518
# - _je_zone_register due to JEMALLOC_PRIVATE_NAMESPACE=je_ under OS X.
521519
# - but jemalloc-cmake does not run private_namespace.sh
522520
# so symbol name should be _zone_register
523-
if (ENABLE_JEMALLOC AND MAKE_STATIC_LIBRARIES AND OS_DARWIN)
521+
if (ENABLE_JEMALLOC AND USE_STATIC_LIBRARIES AND OS_DARWIN)
524522
set_property(TARGET ${target} APPEND PROPERTY LINK_OPTIONS -u_zone_register)
525523
endif()
526524
endif()

base/base/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ endif ()
4242

4343
target_include_directories(common PUBLIC .. "${CMAKE_CURRENT_BINARY_DIR}/..")
4444

45-
if (OS_DARWIN AND NOT MAKE_STATIC_LIBRARIES)
45+
if (OS_DARWIN AND NOT USE_STATIC_LIBRARIES)
4646
target_link_libraries(common PUBLIC -Wl,-U,_inside_main)
4747
endif()
4848

base/daemon/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ add_library (daemon
66

77
target_include_directories (daemon PUBLIC ..)
88

9-
if (OS_DARWIN AND NOT MAKE_STATIC_LIBRARIES)
9+
if (OS_DARWIN AND NOT USE_STATIC_LIBRARIES)
1010
target_link_libraries (daemon PUBLIC -Wl,-undefined,dynamic_lookup)
1111
endif()
1212

base/glibc-compatibility/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ if (GLIBC_COMPATIBILITY)
3737

3838
target_include_directories(glibc-compatibility PRIVATE libcxxabi ${musl_arch_include_dir})
3939

40-
if (NOT USE_STATIC_LIBRARIES AND NOT MAKE_STATIC_LIBRARIES)
40+
if (NOT USE_STATIC_LIBRARIES AND NOT USE_STATIC_LIBRARIES)
4141
target_compile_options(glibc-compatibility PRIVATE -fPIC)
4242
endif ()
4343

cmake/sanitize.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (SANITIZE)
2323
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2424
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ASAN_FLAGS}")
2525
endif()
26-
if (MAKE_STATIC_LIBRARIES AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
26+
if (USE_STATIC_LIBRARIES AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2727
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libasan")
2828
endif ()
2929
if (COMPILER_GCC)
@@ -48,7 +48,7 @@ if (SANITIZE)
4848
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
4949
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory")
5050
endif()
51-
if (MAKE_STATIC_LIBRARIES AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
51+
if (USE_STATIC_LIBRARIES AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
5252
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libmsan")
5353
endif ()
5454

@@ -69,7 +69,7 @@ if (SANITIZE)
6969
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
7070
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
7171
endif()
72-
if (MAKE_STATIC_LIBRARIES AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
72+
if (USE_STATIC_LIBRARIES AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
7373
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libtsan")
7474
endif ()
7575
if (COMPILER_GCC)
@@ -101,7 +101,7 @@ if (SANITIZE)
101101
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
102102
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
103103
endif()
104-
if (MAKE_STATIC_LIBRARIES AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
104+
if (USE_STATIC_LIBRARIES AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
105105
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libubsan")
106106
endif ()
107107
if (COMPILER_GCC)

contrib/arrow-cmake/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if (OS_FREEBSD)
2929
message (FATAL_ERROR "Using internal parquet library on FreeBSD is not supported")
3030
endif()
3131

32-
if(MAKE_STATIC_LIBRARIES)
32+
if(USE_STATIC_LIBRARIES)
3333
set(FLATBUFFERS_LIBRARY flatbuffers)
3434
else()
3535
set(FLATBUFFERS_LIBRARY flatbuffers_shared)
@@ -84,7 +84,7 @@ set(FLATBUFFERS_BINARY_DIR "${ClickHouse_BINARY_DIR}/contrib/flatbuffers")
8484
set(FLATBUFFERS_INCLUDE_DIR "${FLATBUFFERS_SRC_DIR}/include")
8585

8686
# set flatbuffers CMake options
87-
if (MAKE_STATIC_LIBRARIES)
87+
if (USE_STATIC_LIBRARIES)
8888
set(FLATBUFFERS_BUILD_FLATLIB ON CACHE BOOL "Enable the build of the flatbuffers library")
8989
set(FLATBUFFERS_BUILD_SHAREDLIB OFF CACHE BOOL "Disable the build of the flatbuffers shared library")
9090
else ()

contrib/grpc-cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ set(_gRPC_SSL_LIBRARIES OpenSSL::Crypto OpenSSL::SSL)
4646
set(gRPC_ABSL_PROVIDER "clickhouse" CACHE STRING "" FORCE)
4747

4848
# Choose to build static or shared library for c-ares.
49-
if (MAKE_STATIC_LIBRARIES)
49+
if (USE_STATIC_LIBRARIES)
5050
set(CARES_STATIC ON CACHE BOOL "" FORCE)
5151
set(CARES_SHARED OFF CACHE BOOL "" FORCE)
5252
else ()

contrib/libuv-cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ add_library(ch_contrib::uv ALIAS _uv)
133133
target_compile_definitions(_uv PRIVATE ${uv_defines})
134134
target_include_directories(_uv SYSTEM PUBLIC ${SOURCE_DIR}/include PRIVATE ${SOURCE_DIR}/src)
135135
target_link_libraries(_uv ${uv_libraries})
136-
if (NOT MAKE_STATIC_LIBRARIES)
136+
if (NOT USE_STATIC_LIBRARIES)
137137
target_compile_definitions(_uv
138138
INTERFACE USING_UV_SHARED=1
139139
PRIVATE BUILDING_UV_SHARED=1)

programs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ else()
160160
message(STATUS "ClickHouse keeper-converter mode: OFF")
161161
endif()
162162

163-
if(NOT (MAKE_STATIC_LIBRARIES OR SPLIT_SHARED_LIBRARIES))
163+
if(NOT (USE_STATIC_LIBRARIES OR SPLIT_SHARED_LIBRARIES))
164164
set(CLICKHOUSE_ONE_SHARED ON)
165165
endif()
166166

src/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if(COMPILER_PIPE)
1111
else()
1212
set(MAX_COMPILER_MEMORY 1500)
1313
endif()
14-
if(MAKE_STATIC_LIBRARIES)
14+
if(USE_STATIC_LIBRARIES)
1515
set(MAX_LINKER_MEMORY 3500)
1616
else()
1717
set(MAX_LINKER_MEMORY 2500)
@@ -193,7 +193,7 @@ add_subdirectory(Common/Config)
193193

194194
set (all_modules)
195195
macro(add_object_library name common_path)
196-
if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
196+
if (USE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
197197
add_headers_and_sources(dbms ${common_path})
198198
else ()
199199
list (APPEND all_modules ${name})
@@ -254,7 +254,7 @@ endif()
254254

255255
set (DBMS_COMMON_LIBRARIES)
256256

257-
if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
257+
if (USE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
258258
add_library (dbms STATIC ${dbms_headers} ${dbms_sources})
259259
target_link_libraries (dbms PRIVATE ch_contrib::libdivide ${DBMS_COMMON_LIBRARIES})
260260
if (TARGET ch_contrib::jemalloc)

0 commit comments

Comments
 (0)