Cannot provide /nologo to MSVC's rc.exe via add_compile_options
My version of rc.exe properly supports the /nologo flag, and not providing it gives me a lot of build noise.
I tried to use
add_compile_options($<$<COMPILE_LANGUAGE:RC>:/nologo>)
and
CMAKE_RC_FLAGS_INIT
in my toolchain file to suppress the noise, but somehow both of these resulted in the rc.exe command having "/nologo /nologo"
In order to get this to work, I needed to modify CMAKE_RC_COMPILE_OBJECT directly:
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> /nologo <DEFINES> <INCLUDES> <FLAGS> /fo <OBJECT> <SOURCE>")
I could not determine where the second /nologo was coming from, and presume it's part of the internal C++ code of cmake.
The ideal situation would be for CMake to attempt to run rc.exe and determine whether it properly handles /nologo, and add that flag automatically.
Second best would be to simply add the flag unconditionally.