# Trying to add model files to VS project using cmake

**URL:** <https://discourse.cmake.org/t/trying-to-add-model-files-to-vs-project-using-cmake/1790>\
**Category:** Code\
**Tags:** comp:msvc, gen:vs, os:windows\
**Created:** [September 7, 2020, 8:21pm UTC](https://discourse.cmake.org/t/trying-to-add-model-files-to-vs-project-using-cmake/1790 "2020-09-07T20:21:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zwan](https://discourse.cmake.org/user_avatar/discourse.cmake.org/zwan/32/816_2.png) [@Zwan](https://discourse.cmake.org/u/Zwan)\
**Post date:** [September 7, 2020, 8:21pm UTC](https://discourse.cmake.org/t/trying-to-add-model-files-to-vs-project-using-cmake/1790/1 "2020-09-07T20:21:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Zwan](https://discourse.cmake.org/user_avatar/discourse.cmake.org/zwan/32/816_2.png) [@Zwan](https://discourse.cmake.org/u/Zwan)\
**Post date:** [September 8, 2020, 7:12pm UTC](https://discourse.cmake.org/t/trying-to-add-model-files-to-vs-project-using-cmake/1790/2 "2020-09-08T19:12:38Z")

</div>

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?

---

<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:** [November 15, 2020, 2:52pm UTC](https://discourse.cmake.org/t/trying-to-add-model-files-to-vs-project-using-cmake/1790/3 "2020-11-15T14:52:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)\
**Post date:** [November 16, 2020, 2:52pm UTC](https://discourse.cmake.org/t/trying-to-add-model-files-to-vs-project-using-cmake/1790/4 "2020-11-16T14:52:47Z")

</div>

This looks like [CMake Issue 18820](https://gitlab.kitware.com/cmake/cmake/-/issues/18820).

---

<div class="post-metadata">

**Author:** ![Zwan](https://discourse.cmake.org/user_avatar/discourse.cmake.org/zwan/32/816_2.png) [@Zwan](https://discourse.cmake.org/u/Zwan)\
**Post date:** [November 18, 2021, 10:19am UTC](https://discourse.cmake.org/t/trying-to-add-model-files-to-vs-project-using-cmake/1790/5 "2021-11-18T10:19:09Z")

</div>

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