Cannot set per-target flags for the Windows rc compiler
The Windows resource compiler (rc.exe / windres.exe) is represented as language "RC" in CMake. But it's not possible to set flags per target for this tool. Or at least not the way I've tried. Consider this example:
cmake_minimum_required(VERSION 3.21)
project(rc_compiler_specific_flags_per_target)
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" "int main() {}")
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/myexe.rc" "/* empty resource */")
add_executable(myexe main.cpp myexe.rc)
target_compile_options(myexe PRIVATE $<$<COMPILE_LANGUAGE:RC>:/invalid-switch>)
This example compiles without error despite the attempt to pass an invalid switch to rc.
This was discussed before here: https://discourse.cmake.org/t/is-compile-language-rc-supported-for-resource-files/3142