Automatic QRC handling seems broken with Visual Studio Version 17.14.3 and qt 6.8+ for shared libraries

Automatic QRC handling seems broken with Visual Studio Version 17.14.3 and qt 6.8+ for shared libraries. Using cmake version 4.0.2. This works with qt 6.6 however after going to qt 6.8 or 6.9 it stopped working. I have had this happen with two different shared libraries. No problem with executables.

It generates and builds the qrc_name.cpp file but the object file ends up in the wrong location with the wrong name. The error I get is the following: Couldn't open file '.../build-win10-msvc143/name.dir/Release/qrc_name.obj' with CreateFile(). Looking in visual studio it is generating the object file in the following location: $(IntDir)/name_autogen/EWIEGA46WW_Debug/qrc_name.cpp.obj". However in a correctly working exe file it generates the object file in $(IntDir). Its possible this is a qt cmake code issue but it seems like the problem resides on the camke side based on the small amount I have looked into it.

Is this a known issue?

Cc: @alcroito @jobor

I am not aware of any specific regressions.

Please create a small reproducer and share it either on the CMake bug tracker or the Qt one.

https://gitlab.kitware.com/cmake/cmake/-/issues

Thanks. Does it sound like the issue is on the cmake side and not in qt cmake code?

It’s hard to say.

You said the behavior changes between Qt versions, so it could be on the Qt side.

Are you using CMAKE_AUTORCC? Or are you using qt_add_resources?

Yes.

SET(CMAKE_AUTORCC ON)

https://gitlab.kitware.com/cmake/cmake/-/issues/26977

FYI: It works correctly with qt_add_resources.