Trying to add model files to VS project using cmake

Hi everyone.

I use cmake to generate a Visual Studio project of my project. Now I want to add different model files like .blend, .ply, .obj as source files to have access from the IDE.
Besides, I want to create&deploy a UWP app that loads model files during runtime With set_source_files_properties(${file} PROPERTIES 1 VS_DEPLOYMENT_LOCATION "subfolder") Everything works fine for non .obj files. For Win32 builds I can use HEADER_FILE_ONLY for .obj files to prevent linking errors.
But for UWP apps these files are not included in the deployment so files can’t be found after execution.
I also used VS_TOOL_OVERRIDE "None" as file property to resolve this issue. But unfortunately it works for all but .obj files.
When inspecting the vcxproj file all other model files are added with but obj file with . Combination of HEADER_FILE_ONLY and VS_TOOL_OVERRIDE changes it to ClInclude.
Has anyone an idea how to solve this?

1 Like

I guess although target_sources is used to add the obj-file. It isn’t treated as source file and is not affected or not found by using set_source_files_properties.
I suppose this is a really rare use case but do you someone sees any chance find a workaround?

I suspect this may have something to do with the .obj extension itself. This matches the extension for compiler outputs which may involve other logic paths that you’re not intending to include.

Cc: @brad.king

This looks like CMake Issue 18820.

1 Like

@brad.king thx for this hint. I already searched on that issue but didn’t find that one