CetMakeLibrary¶
Module defining the function :command`cet_make_library` to generate libraries and plugins.
- cet_make_library¶
Create a library.
cet_make_library([<name-options>] [<type-options>] [<library-options>] [<target-options>] [<miscellaneous-options>])
Options¶
Name Options¶
BASENAME_ONLYCalculate the name of the library based only on the basename of
CMAKE_CURRENT_SOURCE_DIR; mutually-exclusive withLIBRARY_NAME.LIBRARY_NAME <name>Specify the library name as
name. If this option is not provided the library’s name will be calculated from the relative path ofCMAKE_CURRENT_SOURCE_DIRwith respect toCETMODULES_CURRENT_PROJECT_SOURCE_DIRsubject to possible modification byUSE_PROJECT_NAME(replacing path-separators with_).LIBRARY_NAMEis mutually-exclusive withBASENAME_ONLY.LIBRARY_NAME_VAR <var>Return the calculated/modified library name in the variable
<var>.USE_PROJECT_NAMEModify the provided or calculated library name by prepending
CETMODULES_CURRENT_PROJECT_NAMEand a separating_.
Type Options¶
INTERFACE, MODULE, OBJECT, SHARED, STATICMake a CMake library of the specified type(s). An
INTERFACElibrary is incompatible with every other library type, and theSHAREDandMODULELibrary types are mutually incompatible.See also
NO_OBJECTDisable the automatic addition and use of an
OBJECTlibrary where it would otherwise be appropriate (e.g.STATICandSHAREDare both specified).WITH_STATIC_LIBRARYDeprecated since version 3.23.00: use
STATICinstead.
Library Options¶
INSTALLED_PATH_BASE <base>Specify the path to the installation directory for
SOURCEheaders relative toproject variable<PROJECT-NAME>_INCLUDE_DIR. Only valid forINTERFACE-type libraries.LIBRARIES <library-specification> ...Library dependencies (passed to
target_link_libraries()).LOCAL_INCLUDE_DIRS <dir> ...Specify local include directories.
NO_SOURCEIndicate that no sources are specified at this time. Add them later with
target_sources(). Mutually-exclusive withSOURCE <source> ....SOURCE <source> ...Source files for inclusion in the library. Mutually-exclusive with
NO_SOURCE.SOVERSION <api-version>Specify the
API versionof the library.STRIP_LIBSAfter the library is built, symbols will be stripped using strip(1).
USE_BOOST_UNITThe library uses Boost unit test functions and should be compiled and linked accordingly.
VERSION [<build-version>]Specify the
build versionof the library. If the<build-version>is missing, useCETMODULES_CURRENT_PROJECT_VERSION.
Target Options¶
ALIAS <alias-target> ...Add
<alias-target> ...as aliases for the primary library target. If<alias-target>is scoped (contains::) the alias will be defined as a non-exported (build-time only) target exactly as specified. Otherwise it will be scoped according toEXPORT_SETif specified, or the default namespace defined bycet_register_export_set()if not.See also
EXCLUDE_FROM_ALLSet the
EXCLUDE_FROM_ALLproperty on all targets.EXPORT_SET <export-set>The library will be exported as part of the specified export set.
HEADERS_TARGETDefine an
INTERFACEtarget<CETMODULES_CURRENT_PROJECT_NAME>_headersembodying the locations of include directories for the package.HEADERS_TARGET_ONLYDefine _only_ the target
<CETMODULES_CURRENT_PROJECT_NAME>_headers(impliesHEADERS_TARGET).NO_EXPORTTargets will not be exported or installed.
TARGET_NAME <target-name>Specify the primary target name independently of the library name. If
<target-name>is the special keyword,BASENAMEthen the target will be set to the basename ofCMAKE_CURRENT_SOURCE_DIR.
Miscellaneous Options¶
NOPOption / argument disambiguator; no other function.
Details¶
cet_make_library()is a “one-stop shop” for creating, installing, and exporting libraries:Library file and target names may be calculated or specified—independently or otherwise as desired.
Alias targets can be created and exported along with their target libraries.
Library build and API versions may be specified.
Libraries may be stripped of symbols afer building.
cet_make_library()does all the bookkeeping necessary to ensure that necessary dependencies are found when the installed package is used downstream viafind_package()
Cetmodules