rapids_export_write_language#

Added in version v21.06.00.

Creates a self-contained file that makes sure the requested language is enabled globally.

rapids_export_write_language( (BUILD|INSTALL) (CXX|CUDA|...) <file_path> )

The contents of <file_path> will be a self-contained file that when called via include will make sure the requested language is enabled globally.

This is required as CMake’s enable_language only supports enabling languages for the current directory scope, and doesn’t support being called from within functions. These limitations make it impossible for packages included via CPM to enable extra languages.

Note

This uses some serious CMake black magic to make sure that enable_language occurs both at the call site, and up the entire enable_language stack so the language is enabled globally.

In CMake 4.5 and later this is not needed as enable_language supports being called from within functions and in subdirectories to enable languages globally. This function will just call enable_language in these versions when the policy CMP0220 is set to NEW where the <file_path> is included.