Is $<COMPILE_LANGUAGE:RC> supported for resource files?

I have compile definitions I’d like to only enable for .rc files in our msvc project.

I’d like to use the generator expression as follows:

target_compile_definitions(foobar PRIVATE
    $<$<COMPILE_LANGUAGE:RC>:
        FOOBAR_RC
    >
)

Looking at the docs it isn’t clear if this is supported.

I…honestly have no idea. Does it appear to work? If not, I guess an issue is in order.

Doesn’t seem to work. Just tried it locally.

add_executable(foobar)
target_sources(foobar PRIVATE main.cpp demo.rc)

target_compile_definitions(foobar PRIVATE
    $<$<COMPILE_LANGUAGE:RC>:FOOBAR_RC>
    FOOBAR_GENERIC
)

@ben.boeckel should I make the issue then?

Yes, please. I’d rather someone who knows (and has a stake in) the issue to write it up and be in the discussion rather than me playing messenger :slight_smile: .

Hi, I also ran into this. But I did not find an issue on the bug tracker.
@YMba9g8j9CJp0wLoQf5y, if you have created one, please mark my issue as duplicate: https://gitlab.kitware.com/cmake/cmake/-/issues/22856