Exporting is a technique to add information about a package that you built locally to CMake's package registry. This is useful when you want your targets to be visible right from their build directories, even without installation. A common use for exporting is when you have several projects checked out on your development machine and you build them locally.
It's quite easy to add support for this mechanism from your CMakeLists.txt files. In our case, it can be done in this way:
export(
TARGETS libcustomer customer
NAMESPACE domifair::
FILE CustomerTargets.cmake)
set(CMAKE_EXPORT_PACKAGE_REGISTRY ON)
export(PACKAGE domifair)
This way, CMake will create a targets file similar to the one from the Installing section, defining our library and executable targets in the namespace we provided. From CMake 3.15, the package registry is disabled by default, so we need to enable it by setting the appropriate preceding variable. Then, we can put the information about our targets...