2023-07-26 10:13:27 +02:00
|
|
|
find_program(COMPDB_PATH
|
|
|
|
NAME compdb
|
|
|
|
PATHS ~/.local/bin/
|
|
|
|
/bin
|
|
|
|
/sbin
|
|
|
|
/usr/bin
|
|
|
|
/usr/sbin
|
|
|
|
/usr/local/bin
|
|
|
|
/usr/local/sbin
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-11-19 18:20:20 +01:00
|
|
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
2023-07-26 10:13:27 +02:00
|
|
|
|
2024-11-19 18:20:20 +01:00
|
|
|
if (COMPDB_PATH)
|
|
|
|
IF(NOT TARGET COMPD)
|
|
|
|
add_custom_target(COMPD
|
|
|
|
ALL
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
COMMAND ${COMPDB_PATH} -p ${CMAKE_CURRENT_BINARY_DIR} list >compile_commands.json
|
|
|
|
)
|
|
|
|
endif()
|
2023-07-26 10:13:27 +02:00
|
|
|
endif()
|
|
|
|
endif()
|