mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
6ce8947417
Globbing generally misses to pick up files which were added/deleted after CMake's configure. This is a nuissance but can be alleviated using CONFIGURE_DEPENDS (available since CMake 3.12) which adds a check for new/deleted files before each compile and - if necessary - restarts the configuration. On my system, the check takes < 0.1 sec. (Side note: CONFIGURE_DEPENDS is not guaranteed to work accross all generators, but at least it works for Ninja which everyone @CH seems to use.)
14 lines
524 B
CMake
14 lines
524 B
CMake
macro(add_glob cur_list)
|
|
file(GLOB __tmp CONFIGURE_DEPENDS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${ARGN})
|
|
list(APPEND ${cur_list} ${__tmp})
|
|
endmacro()
|
|
|
|
macro(add_headers_and_sources prefix common_path)
|
|
add_glob(${prefix}_headers ${CMAKE_CURRENT_SOURCE_DIR} ${common_path}/*.h)
|
|
add_glob(${prefix}_sources ${common_path}/*.cpp ${common_path}/*.c ${common_path}/*.h)
|
|
endmacro()
|
|
|
|
macro(add_headers_only prefix common_path)
|
|
add_glob(${prefix}_headers ${CMAKE_CURRENT_SOURCE_DIR} ${common_path}/*.h)
|
|
endmacro()
|