# Possible bug setting VS\_SETTINGS "ExcludedFromBuild=true" for Wavefornt obj files.

**URL:** <https://discourse.cmake.org/t/possible-bug-setting-vs-settings-excludedfrombuild-true-for-wavefornt-obj-files/2494>\
**Category:** Code\
**Created:** [January 8, 2021, 5:49am UTC](https://discourse.cmake.org/t/possible-bug-setting-vs-settings-excludedfrombuild-true-for-wavefornt-obj-files/2494 "2021-01-08T05:49:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manjot\_Bal](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/57b2e6/32.png) [@Manjot\_Bal](https://discourse.cmake.org/u/Manjot_Bal)\
**Post date:** [January 8, 2021, 5:49am UTC](https://discourse.cmake.org/t/possible-bug-setting-vs-settings-excludedfrombuild-true-for-wavefornt-obj-files/2494/1 "2021-01-08T05:49:31Z")

</div>

Hi,

When I include a Wavefront obj file to my project and generate a Visual Studio solution, the generator labels the file as an obj file meant for the c++ linker. See the following from my .vcxproj file.

This causes an error when building and linking. To get around this I thought to set item metadata property ExcludedFromBuild=true. See below for the code.

file(GLOB\_RECURSE RESOURCES  
“${CMAKE\_SOURCE\_DIR}/rsc/_.glsl"  
"${CMAKE\_SOURCE\_DIR}/rsc/_.jpeg”  
“${CMAKE\_SOURCE\_DIR}/rsc/_.png"  
)  
file(GLOB\_RECURSE RESOURCES\_OBJ  
"${CMAKE\_SOURCE\_DIR}/rsc/_.obj”  
)  
target\_sources(${CMAKE\_PROJECT\_NAME} PUBLIC ${RESOURCES} ${RESOURCES\_OBJ})  
set\_property(SOURCE ${RESOURCES\_OBJ} PROPERTY VS\_SETTINGS “ExcludedFromBuild=true”)

The set\_property command does not do anything though. If I were to replace ${RESOURCES\_OBJ} with ${RESOURCES} then those image/glsl files will be excluded from the build, but there is no need to set this property for these files because Visual Studio already excludes files with these extensions from the build.

I tried this with CMake version 3.19.2.

Thanks.

---

<div class="post-metadata">

**Author:** ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)\
**Post date:** [January 8, 2021, 8:35am UTC](https://discourse.cmake.org/t/possible-bug-setting-vs-settings-excludedfrombuild-true-for-wavefornt-obj-files/2494/2 "2021-01-08T08:35:16Z")

</div>

You could try setting the `.obj` files’ [`HEADER_FILE_ONLY` property](https://cmake.org/cmake/help/latest/prop_sf/HEADER_FILE_ONLY.html) to `TRUE`. I haven’t tested it, but it might help.

---

<div class="post-metadata">

**Author:** ![Manjot\_Bal](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/57b2e6/32.png) [@Manjot\_Bal](https://discourse.cmake.org/u/Manjot_Bal)\
**Post date:** [January 8, 2021, 7:53pm UTC](https://discourse.cmake.org/t/possible-bug-setting-vs-settings-excludedfrombuild-true-for-wavefornt-obj-files/2494/3 "2021-01-08T19:53:24Z")

</div>

That works! I am now able to add Wavefront obj files without any linker errors. Thank you.
