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_ONLY
Calculate 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_DIR
with respect toCETMODULES_CURRENT_PROJECT_SOURCE_DIR
subject to possible modification byUSE_PROJECT_NAME
(replacing path-separators with_
).LIBRARY_NAME
is mutually-exclusive withBASENAME_ONLY
.LIBRARY_NAME_VAR <var>
Return the calculated/modified library name in the variable
<var>
.USE_PROJECT_NAME
Modify the provided or calculated library name by prepending
CETMODULES_CURRENT_PROJECT_NAME
and a separating_
.
Type Options¶
INTERFACE, MODULE, OBJECT, SHARED, STATIC
Make a CMake library of the specified type(s). An
INTERFACE
library is incompatible with every other library type, and theSHARED
andMODULE
Library types are mutually incompatible.See also
NO_OBJECT
Disable the automatic addition and use of an
OBJECT
library where it would otherwise be appropriate (e.g.STATIC
andSHARED
are both specified).WITH_STATIC_LIBRARY
Deprecated since version 3.23.00: use
STATIC
instead.
Library Options¶
INSTALLED_PATH_BASE <base>
Specify the path to the installation directory for
SOURCE
headers 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_SOURCE
Indicate 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 version
of the library.STRIP_LIBS
After the library is built, symbols will be stripped using strip(1).
USE_BOOST_UNIT
The library uses Boost unit test functions and should be compiled and linked accordingly.
VERSION [<build-version>]
Specify the
build version
of 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_SET
if specified, or the default namespace defined bycet_register_export_set()
if not.See also
EXCLUDE_FROM_ALL
Set the
EXCLUDE_FROM_ALL
property on all targets.EXPORT_SET <export-set>
The library will be exported as part of the specified export set.
HEADERS_TARGET
Define an
INTERFACE
target<CETMODULES_CURRENT_PROJECT_NAME>_headers
embodying the locations of include directories for the package.HEADERS_TARGET_ONLY
Define _only_ the target
<CETMODULES_CURRENT_PROJECT_NAME>_headers
(impliesHEADERS_TARGET
).NO_EXPORT
Targets 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,BASENAME
then the target will be set to the basename ofCMAKE_CURRENT_SOURCE_DIR
.
Miscellaneous Options¶
NOP
Option / 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()