title: RC short-description: Compiling Windows resources ...
Since 1.11.0
Meson has support for compiling Windows resource files (.rc). To use it, add rc to your project languages:
project('myapp', 'c', 'rc') executable('myapp', 'main.c', 'resources.rc')
You can also add the language conditionally, which is useful for cross-compilation setups where an RC compiler may not always be available:
project('myapp', 'c') if add_languages('rc', required: false, native: false) # .rc sources can be used in targets endif
The following resource compilers are detected automatically:
| Compiler id | Tool | CLI style |
|---|---|---|
| rc | Microsoft rc.exe | MSVC |
| llvm-rc | LLVM llvm-rc | MSVC |
| windres | GNU windres | GCC |
| llvm-windres | LLVM llvm-windres | GCC |
| wrc | Wine wrc | GCC |
Meson will look for the rc binary in the [binaries] section of your machine file, or through the RC and WINDRES environment variables.
Extra flags can be passed to the resource compiler using the standard Meson mechanisms:
# Via project arguments add_project_arguments('-DPROJECT_DEF', language: 'rc') # Via per-target keyword argument executable('myapp', 'main.c', 'resources.rc', rc_args: ['-DLIB_BUILD'])
The RCFLAGS environment variable is also respected.
Include directories work the same as for other languages:
inc = include_directories('res') executable('myapp', 'main.c', 'resources.rc', include_directories: inc)