Skip to content

Commit 3299b5c

Browse files
committed
build UPDATE allow disabling common targets
1 parent b0c95a7 commit 3299b5c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ option(ENABLE_FUZZ_TARGETS "Build target programs suitable for fuzzing with AFL"
246246
option(ENABLE_INTERNAL_DOCS "Generate doxygen documentation also from internal headers" OFF)
247247
option(ENABLE_YANGLINT_INTERACTIVE "Enable interactive CLI yanglint" ON)
248248
option(ENABLE_TOOLS "Build binary tools 'yanglint' and 'yangre'" ON)
249+
option(ENABLE_COMMON_TARGETS "Define common custom target names such as 'doc' or 'uninstall', may cause conflicts when using add_subdirectory() to build this project" ON)
249250
option(BUILD_SHARED_LIBS "By default, shared libs are enabled. Turn off for a static build." ON)
250251
set(YANG_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/yang/modules/libyang" CACHE STRING "Directory where to copy the YANG modules to")
251252

@@ -462,10 +463,12 @@ if(ENABLE_TOOLS)
462463
endif()
463464

464465
# generate doxygen documentation for libyang API
465-
gen_doc("${doxy_files}" ${LIBYANG_VERSION} ${LIBYANG_DESCRIPTION} ${project_logo})
466+
if(ENABLE_COMMON_TARGETS)
467+
gen_doc("${doxy_files}" ${LIBYANG_VERSION} ${LIBYANG_DESCRIPTION} ${project_logo})
468+
endif()
466469

467470
# generate API/ABI report
468-
if ("${BUILD_TYPE_UPPER}" STREQUAL "ABICHECK")
471+
if("${BUILD_TYPE_UPPER}" STREQUAL "ABICHECK")
469472
lib_abi_check(yang "${headers}" ${LIBYANG_SOVERSION_FULL} dae82c1a652bdca0074544c62469a7f51d92c5e8)
470473
endif()
471474

@@ -474,7 +477,9 @@ endif()
474477
source_format(${format_sources})
475478

476479
# uninstall
477-
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_MODULE_PATH}/uninstall.cmake")
480+
if(ENABLE_COMMON_TARGETS)
481+
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_MODULE_PATH}/uninstall.cmake")
482+
endif()
478483

479484
# clean cmake cache
480485
add_custom_target(cclean

0 commit comments

Comments
 (0)