Support for generator expressions in call to set_source_properties() ?

Hello

When using file(GENERATE), I normally need to use $<CONFIG> as part of the target file name (or path name), because file(GENERATE) will generate a file for each configuration.

But when I set source properties on the same generated file, generator expressions like $lt;CONFIG> are not supported in the file name.

So I wrote a function like VersionInfo_Generate(TARGET tgt …), to generate a VERSIONINFO resource file, lets say a file named "MyParser_VersionInfo-$<CONFIG>.rc ". This is used by the resource compiler on Windows (hence the .rc extension) to embed product name and version strings into a .dll or an .exe file, and they become publicly visible in the Windows explorer Properties dialog for the binary.

Then I also added an ICON resource to the same resource file. An ICON resource simply names another .ico file from my project (by path) as the icon file for my executable.

So the icon file should now be included in the OBJECT_DEPENDS source property for the VersionInfo-*.rc source file.This allows the resource compiler to be invoked again when there are changes to the icon file.

Now I need to use

set_property(SOURCE "MyParser_VersionInfo_$<CONFIG>.rc" 
      APPEND PROPERTY OBJECT_DEPENDS "${MyParser_SOURCE_DIR}/my_exe_icon.ico")

But now the source file name includes the generator expression $<CONFIG>, and so the call to set_property(SOURCE) will not work.

I do not see any way around this problem, is just a limitation in CMake ?

Can anyone help me with this ? Is it possible for CMake to add support for generator expressions in this case ?

1 Like

Like very good