From 92acbf1bf4bfef7aa46bd143d5b40460a16850c1 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Wed, 8 Apr 2026 06:13:26 +0300
Subject: Document tde_add_library()

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 modules/TDEMacros.cmake | 84 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index c23fd64..da8b12b 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -902,6 +902,90 @@ endmacro()
 #################################################
 #####
 ##### tde_add_library
+#####
+##### The macro creates a target for a library. The target will be called <name>-shared for shared
+##### libraries, <name>-static for static and <name>-module for modules. Besides that the macro
+##### also does (including but not limited):
+##### - install the library if DESTINATION is given
+##### - creates symlinks for installed library with appropriate version appended to name
+##### - generate and installs a libtool file for the library
+##### - sets -fPIC unless the type is STATIC (not STATIC_PIC)
+##### - links libraries/adds dependencies according to given arguments
+##### - automatically mocs files if requested
+##### - embeds metadata if tdelfeditor is available
+##### - generates files with imported cmake targets
+#####
+##### Syntax:
+#####   tde_add_library (
+#####     <name> [type]
+#####     SOURCES <file> [<file> ...]
+#####     [DESTINATION] <dest>]
+#####     [LINK <lib> [<lib> ... ]
+#####     [LINK_PRIVATE <lib> [<lib> ... ]
+#####     [EMBED <lib-static> [<lib-static> ...]
+#####     [DEPENDENCIES <dep> [<dep> ... ]
+#####     [AUTOMOC]
+#####     [META_INCLUDES <path> [<path> ...]]
+#####     [NO_LIBTOOL_FILE]
+#####     [NO_EXPORT]
+#####     [VERSION <version>]
+#####     [RELEASE <version>]
+#####     [CXX_FEATURES <feat> [<feat> ...]]
+#####     [CXX_FEATURES_PRIVATE <feat> [<feat> ...]]
+#####     [DESCRIPTION] [LICENSE] [COPYRIGHT] [AUTHORS]
+#####     [PRODUCT] [ORGANIZATION] [DATETIME]
+#####     [NOTES]
+#####   )
+#####
+##### @arg name            The basename of the library; the target will be called "<name>-shared"
+#####                      for SHARED libs, "<name>-static" for STATIC and STATIC_PIC, and
+#####                      "<name>-module" for MODULE.
+##### @arg type            The type of the library to build; is one of:
+#####                      - SHARED - build a normal shared library
+#####                      - STATIC - build a static library without an -fPIC flag. Such a library
+#####                                 can experience difficulties being linked into
+#####                                 modern executables/shared libraries.
+#####                      - STATIC_PIC - build a static library with an -fPIC flag. If you are
+#####                                     building a static lib usually you want that.
+#####                      - MODULE - a dynamically loaded module. If you are building a kpart, you
+#####                                 want that.
+#####                      If none of the above specified the library will be either SHARED or
+#####                      STATIC depending on the value of BUILD_SHARED_LIBS.
+##### @arg SOURCES         The list of sources to build the library from. At least one source file
+#####                      must be specified.
+##### @arg DESTINATION     The path to install the library to. If omitted the library won't be
+#####                      installed
+##### @arg LINK            The list of libraries this library (and all targets that are linking to
+#####                      the library) link against. These are passed to target_link_libraries()
+#####                      as PUBLIC.
+##### @arg LINK_PRIVATE    The list of libraries this library will be linked against privately.
+#####                      These are passed to target_link_libraries() as PRIVATE.
+##### @arg EMBED           A list of static libraries that should be embedded into the shared one with
+#####                      "-Wl,-whole-archive".
+##### @arg DEPENDENCIES    The list of dependencies which will be built before the target
+##### @arg AUTOMOC         if set all the SOURCES will be searched for '#include "header.moc"'
+#####                      include directives and appropriate headers will be processed by tqmoc.
+##### @arg META_INCLUDES   Additional paths to check for includes when AUTOMOC'ing the sources.
+##### @arg NO_LIBTOOL_FILE do not generate .la file (relevant for SHARED and MODULE libraries)
+##### @arg NO_EXPORT       do not generate cmake export target file for the library (relevant only
+#####                      if DESTINATION is set)
+##### @arg VERSION         the library version in the form of "major.minor.patch". The version is
+#####                      used as a base for soname and shared library filename. All appropriate
+#####                      symlinks are installed as well. Besides that the version is also embedded
+#####                      into metadata if tdelfeditor is available.
+##### @arg RELEASE         use the version as part of the library name. i.e. library will be called
+#####                      libfoo-1.2.3.so See also:
+#####                      https://www.gnu.org/software/libtool/manual/html_node/Release-numbers.html.
+##### @arg CXX_FEATURES    The list of CXX_FEATURES that will be passed to target_compile_features()
+#####                      for the target as PUBLIC
+##### @arg CXX_FEATURES_PRIVATE The list of CXX_FEATURES that will be passed to target_compile_features()
+#####                      for the target as PRIVATE
+##### @arg EXCLUDE_FROM_ALL Don't build this target by default i.e. when "all" target is built. This
+#####                      sets the EXCLUDE_FROM_ALL cmake target property.
+#####
+##### Also next arguments can be used to set metadata, which will be embedded into the binary
+##### if tdelfeditor is available: DESCRIPTION, LICENSE, COPYRIGHT, AUTHORS, PRODUCT, VERSION,
+##### ORGANIZATION, DATETIME, NOTES.
 
 macro( tde_add_library _arg_target )
 
-- 
cgit v1.2.3

