Invoking Scripts During Installation
Explore how to use the install(SCRIPT|CODE) command in CMake to automate tasks during software installation. Learn to run scripts or snippets that perform system-specific actions, such as updating the dynamic linker cache post-installation. This lesson guides you through modifying install targets and conditionally executing installation scripts to enhance your C++ project deployments.
We'll cover the following...
If you have ever installed a shared library on a Unix-like system, you may remember that before you can use it, you'll likely need to tell the dynamic linker to scan trusted directories and build its cache by calling ldconfig.
Command install(SCRIPT|CODE)
If we'd like to make our installation fully automatic, CMake offers the install(SCRIPT|CODE) command to support such cases. Here's the full command's signature:
install([[SCRIPT <file>] [CODE <code>]][ALL_COMPONENTS | COMPONENT <component>][EXCLUDE_FROM_ALL] [...])