cmakeme_install¶
Helper function for typical cmake installation scenarios.
Use this module with find_package(cmakeme)
Commands¶
-
cmakeme_install¶ The
cmakeme_install()function installs the specified targets along with any include files inINTERFACE_INCLUDE_DIRECTORIESor source files inINTERFACE_SOURCES. If the target is a library it will be setup to be imported from other cmake files.cmakeme_install(TARGETS targets... [NAMESPACE ns] [ARCH_INDEPENDENT] [PACKAGE_NAME name] [DEPENDS deps..] )
TARGETS targetsThe targets that should be installed. This is the only option necessary if the targets do not need to be found by other cmake modules. If target.bin is also defined as a target it will be installed as well.NAMESPACE nsNamespace for name. If not specified the targets will not be exported. Do not include the :: after the namespace. Link against the configured targets by passing ns::target to target_link_librariesARCH_INDEPENDENTSpecify for an architecture-independent library, such as a header-only library.PACKAGE_NAME nameThe name of the package, as used by find_package. So the package will be imported via find_package(name) defaults to the value of nsDEPENDS deps:w The dependencies of the listed targets that should be found when find_package(name) is called. In other words, imported dependencies that are required for using the targetNote
Use
target_include_directories(target INTERFACE $<BUILD_INTERFACE:directory>)to add include directories andtarget_sources(target INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/source1>... )to add source files. The$<BUILD_INTERFACE:>generator expression only adds the items in it during build time. At install time, the location of the files moves.cmakeme_installwill add the proper paths to the$<INSTALL_INTERFACE:>for use at installation time.