Skip to content

Commit 85dae8e

Browse files
authored
Merge pull request #302 from Enmk/add_debug_dependencies
added DEBUG_DEPENDENCIES
2 parents 5a140ad + 1350915 commit 85dae8e

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

CMakeLists.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ OPTION (WITH_OPENSSL "Use OpenSSL for TLS connections" OFF)
1313
OPTION (WITH_SYSTEM_ABSEIL "Use system ABSEIL" OFF)
1414
OPTION (WITH_SYSTEM_LZ4 "Use system LZ4" OFF)
1515
OPTION (WITH_SYSTEM_CITYHASH "Use system cityhash" OFF)
16+
OPTION (DEBUG_DEPENDENCIES "Print debug info about dependencies duting build" ON)
1617

1718
PROJECT (CLICKHOUSE-CLIENT)
1819

@@ -99,3 +100,36 @@ PROJECT (CLICKHOUSE-CLIENT)
99100
ut
100101
)
101102
ENDIF (BUILD_TESTS)
103+
104+
if(DEBUG_DEPENDENCIES)
105+
function(print_target_properties target)
106+
MESSAGE("${target} properties:")
107+
set(properties "${ARGN}")
108+
foreach(property_name ${properties})
109+
get_target_property(PROPERTY ${target} ${property_name})
110+
MESSAGE(NOTICE "\t${property_name} : ${PROPERTY}")
111+
endforeach()
112+
113+
# Can't get path to the target file at configure time,
114+
# so have to create a target to fetch that info at generate time.
115+
string(REPLACE ":" "_" target_plain_name ${target})
116+
add_custom_target(${target_plain_name}_print_debug_info COMMAND ${CMAKE_COMMAND} -E echo "${target} : $<TARGET_FILE:${target}>")
117+
add_dependencies(clickhouse-cpp-lib ${target_plain_name}_print_debug_info)
118+
endfunction()
119+
120+
function(print_target_debug_info target)
121+
print_target_properties(${target}
122+
INCLUDE_DIRECTORIES
123+
BINARY_DIR
124+
INTERFACE_INCLUDE_DIRECTORIES
125+
INTERFACE_LINK_LIBRARIES
126+
LINK_LIBRARIES
127+
LINK_LIBRARIES_ONLY_TARGETS
128+
IMPORTED_LOCATION
129+
)
130+
endfunction()
131+
132+
print_target_debug_info(absl::int128)
133+
print_target_debug_info(cityhash::cityhash)
134+
print_target_debug_info(lz4::lz4)
135+
endif()

cmake/Findlz4.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ if (lz4_FOUND)
3232
if (NOT TARGET lz4::lz4)
3333
add_library(lz4::lz4 UNKNOWN IMPORTED)
3434
set_target_properties(lz4::lz4 PROPERTIES
35+
INCLUDE_DIRECTORIES ${lz4_INCLUDE_DIRS}
3536
IMPORTED_LOCATION "${lz4_LIBRARY}"
3637
INTERFACE_INCLUDE_DIRECTORIES "${lz4_INCLUDE_DIR}")
3738
endif ()

0 commit comments

Comments
 (0)