1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-24 13:41:03 +03:00

Make compile-commands generation conditional

To not "pollute" projects with the compile-commands.json link if they include
libssh as a subproject (e.g. with add_subdirectory()), check if libssh is the
root project and only create the link in this case.

Signed-off-by: Sven Fischer <sven@leiderfischer.de>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Sven Fischer
2023-12-05 11:58:01 +01:00
committed by Sahana Prasad
parent 12b1fcdfcf
commit ae4040a7eb

View File

@@ -225,10 +225,13 @@ endif (CMAKE_BUILD_TYPE STREQUAL "Coverage")
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source DEPENDS ${_SYMBOL_TARGET} VERBATIM)
# Link compile database for clangd
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
get_directory_property(hasParent PARENT_DIRECTORY)
if(NOT(hasParent))
# Link compile database for clangd if we are the master project
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
"${CMAKE_BINARY_DIR}/compile_commands.json"
"${CMAKE_SOURCE_DIR}/compile_commands.json")
endif()
message(STATUS "********************************************")
message(STATUS "********** ${PROJECT_NAME} build options : **********")