# Is $\<COMPILE\_LANGUAGE:RC\> supported for resource files?

**URL:** https://discourse.cmake.org/t/is-compile-language-rc-supported-for-resource-files/3142
**Category:** Usage
**Tags:** os:windows, comp:msvc
**Created:** [April 14, 2021, 7:49pm UTC](https://discourse.cmake.org/t/is-compile-language-rc-supported-for-resource-files/3142 "2021-04-14T19:49:39Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [April 14, 2021, 7:49pm UTC](https://discourse.cmake.org/t/is-compile-language-rc-supported-for-resource-files/3142/1 "2021-04-14T19:49:39Z")

</div>

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:

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

```

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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 14, 2021, 8:36pm UTC](https://discourse.cmake.org/t/is-compile-language-rc-supported-for-resource-files/3142/2 "2021-04-14T20:36:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [April 14, 2021, 9:28pm UTC](https://discourse.cmake.org/t/is-compile-language-rc-supported-for-resource-files/3142/3 "2021-04-14T21:28:45Z")

</div>

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

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

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

```

 ![image](https://discourse.cmake.org/uploads/default/original/2X/d/da67dd8a8933c572ae3122928b015f08d3d83b3c.png)

---

<div class="post-metadata">

### Author: ![YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ymba9g8j9cjp0wloqf5y/32/1244_2.png) [@YMba9g8j9CJp0wLoQf5y](https://discourse.cmake.org/u/YMba9g8j9CJp0wLoQf5y)
#### Post date: [April 20, 2021, 7:02pm UTC](https://discourse.cmake.org/t/is-compile-language-rc-supported-for-resource-files/3142/4 "2021-04-20T19:02:43Z")

</div>

@ben.boeckel should I make the issue then?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 21, 2021, 1:01am UTC](https://discourse.cmake.org/t/is-compile-language-rc-supported-for-resource-files/3142/5 "2021-04-21T01:01:17Z")

</div>

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 🙂 .

---

<div class="post-metadata">

### Author: ![jobor](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jobor/32/1230_2.png) [@jobor](https://discourse.cmake.org/u/jobor)
#### Post date: [November 4, 2021, 4:04pm UTC](https://discourse.cmake.org/t/is-compile-language-rc-supported-for-resource-files/3142/6 "2021-11-04T16:04:06Z")

</div>

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](https://gitlab.kitware.com/cmake/cmake/-/issues/22856)
