Function portal_install_module¶
Installs a Portal Framework module with CMake package configuration support.
This function automates the installation process for Portal modules, including:
Installing target exports with namespace
portal::Generating and installing CMake package config and version files
Installing file sets (HEADERS and optional additional_headers)
Installing associated resources
Setting config/resource prefix metadata for installed modules
Installing helper CMake scripts
Synopsis¶
portal_install_module(<module_name>
[COMPONENT <component>]
[FILES <file>...])
Arguments¶
<module_name>Name of the module (without the
portal-prefix). The function will automatically construct the target name asportal-<module_name>.COMPONENT <component>Optional. Specifies the installation component name. If not provided, defaults to the target name with hyphens replaced by underscores for NSIS compatibility.
FILES <file>...Optional. List of additional CMake helper files to install alongside the package config file. These files will be automatically included in the generated config file and installed to
share/portal-<module_name>/.
Behavior¶
The function performs the following operations:
Target Installation: Installs the
portal-<module_name>target with its HEADERS file set. If the target has anadditional_headersfile set, it will also be installed.Package Config Files: Generates and installs:
portal-<module_name>-config.cmake: Package configuration fileportal-<module_name>-version.cmake: Version file with ExactVersion compatibilityportal-<module_name>-targets.cmake: Target export file withportal::namespace
Resources: If the target has a
PORTAL_RESOURCESproperty set, the function installs those resource directories and configures thePORTAL_RESOURCE_PREFIXproperty in the config file to allow consumers to locate resources correctly.Config Prefix: If the target has
PORTAL_HAS_CONFIGset, the generated config file setsPORTAL_CONFIG_PREFIXon the imported target so consumers can locate installed configs.Helper Files: Any files specified via the
FILESargument are installed and automatically included in the generated config file.
Installation Locations¶
Headers:
${CMAKE_INSTALL_INCLUDEDIR}CMake files:
share/portal-<module_name>/Resources:
resources/
Example Usage¶
Basic module installation:
portal_install_module(core)
Module with custom component and helper files:
portal_install_module(engine
COMPONENT engine_runtime
FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/engine-helpers.cmake)
Notes¶
Uses experimental CMake package dependencies export feature (
CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_DEPENDENCIES)Resource folders are copied from the target’s runtime output directory
The generated config file uses
@PACKAGE_INIT@for relocatable packages
See Also¶
portal_add_module: Creates Portal modules
portal_add_resources: Add resources to modules