Skip to content
Snippets Groups Projects

CMake Interaction Update

Merged Frederik Hennig requested to merge fhennig/cmake into master
All threads resolved!
Viewing commit b5a826f6
Show latest version
5 files
+ 46
17
Preferences
Compare changes
Files
5
@@ -122,6 +122,7 @@ pystencilssfg_generate_target_sources( <target>
[FILE_EXTENSIONS <header-extension> <impl-extension>]
[OUTPUT_MODE <standalone|inline|header-only>]
[CONFIG_MODULE <path-to-config-module.py>]
[OUTPUT_DIRECTORY <output-directory>]
)
```
@@ -138,8 +139,11 @@ The function takes the following options:
- `CONFIG_MODULE`: Set the configuration module for all scripts registered with this call.
If set, this overrides the value of `PystencilsSfg_CONFIG_MODULE`
in the current scope (see [](#cmake_set_config_module))
- `OUTPUT_DIRECTORY`: Custom output directory for generated files. If `OUTPUT_DIRECTORY` is a relative path,
it will be interpreted relative to the current build directory.
Any C++ header files generated by the above call can be included in any files belonging to `target` via:
If `OUTPUT_DIRECTORY` is *not* specified, any C++ header files generated by the above call
can be included in any files belonging to `target` via:
```C++
#include "gen/<file1.hpp>"
@@ -147,12 +151,12 @@ Any C++ header files generated by the above call can be included in any files be
/* ... */
```
### Changing the Output Directory
:::{attention}
If you change the code generator output directory using the `OUTPUT_DIRECTORY` argument,
you are yourself responsible for placing that directory--or any of its parents--on the
include path of your target.
:::
The CMake function listed above will create a subdirectory `_gen/<target>` at the current point in
the build tree (i.e. [`CMAKE_CURRENT_BINARY_DIR`](https://cmake.org/cmake/help/latest/variable/CMAKE_CURRENT_BINARY_DIR.html)).
This directory is placed on the include path of `<target>`, and the generated files will be written to `_gen/<target>/gen/`
such that they can be included with the `gen` prefix.
(cmake_set_config_module)=
### Set a Configuration Module