<div dir="ltr">There is some history on that:<div><br><div><a href="https://gitlab.kitware.com/cmake/cmake/issues/7835">https://gitlab.kitware.com/cmake/cmake/issues/7835</a>  linked to older <a href="https://itk.org/Bug/view.php?id=7835">https://itk.org/Bug/view.php?id=7835</a></div><div><br></div></div><div>May be this is a plain feature request that should be properly written based on history and current usage.</div><div>Typically I think that anyone would want to add any file to IDE project display.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-02 14:57 GMT+01:00 J. Caleb Wherry <span dir="ltr"><<a href="mailto:calebwherry@gmail.com" target="_blank">calebwherry@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">Yes, I understand that. The error message is pretty clear.</div><div dir="auto"><br></div><div dir="auto">My main question is really why is that the case? In VS, there is no restriction to adding files to a utility project. So why does CMake have this restriction?</div><div dir="auto"><br></div><div dir="auto">I assume it is because it is generator specific and there isn’t a clean way to implement add_custom_target across all of them. In that case I would expect some special case handling for generators that do support it.</div><div dir="auto"><br></div><div dir="auto">And it’s not like CMake can’t add files to that Utility project, because it does: it adds the Java rules files. It just doesn’t allow the user the do the same. It’s a restriction that doesn’t really make sense to me.</div><div dir="auto"><br></div><div dir="auto">-Caleb</div><div><div class="h5"><br><div class="gmail_quote"><div>On Fri, Feb 2, 2018 at 3:35 AM CHEVRIER, Marc <<a href="mailto:marc.chevrier@sap.com" target="_blank">marc.chevrier@sap.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="FR" link="#0563C1" vlink="#954F72">
<div class="m_-247803661389720378m_2033950105473046262WordSection1">
<p class="MsoNormal"><span lang="EN-US">This approach is not possible for Java because the command add_jar is implemented using commands add_custom_command and add_custom_target. And command target_sources implies that the
 target was created by one the commands add_library or add_executable.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">CMake <<a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a>> on behalf of "J. Caleb Wherry" <<a href="mailto:calebwherry@gmail.com" target="_blank">calebwherry@gmail.com</a>><br>
<b>Date: </b>Thursday 1 February 2018 at 19:30<br>
<b>To: </b>CMake ML <<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>><br>
<b>Subject: </b>[CMake] How to add files to Visual Studio 'Utility' project<u></u><u></u></span></p>
</div></div></div><div lang="FR" link="#0563C1" vlink="#954F72"><div class="m_-247803661389720378m_2033950105473046262WordSection1">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><a name="m_-247803661389720378_m_2033950105473046262__MailOriginalBody">Hello!<u></u><u></u></a></p>
</div>
<div>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span>I am having trouble with a generated VS project that I hope is either a bug or has an easy fix...<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span>When using UseJava, the add_jar function, and Visual Studio 2015, a VS 'Utility' project is created. I then want to add additional non-compiled files to this project so I try to use target_sources
 but get his error:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span>"target_sources called with non-compilable target type"<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span>In VS, I can easily add files to the project without issue. But I cannot seem to add any additional files to this created 'Utility' project through CMake.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span>I do this in other projects by using target_sources and setting the HEADER_FILE_ONLY and WRAP_EXCLUDE properties to make sure the project doesn't do anything with them and it works fine. Just
 can't do it for these Utility projects.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span>My use case here is that the add_jar command doesn't actually add the java source files to the project. I want to use VS as a code editor in this case because it builds the jar. However, without
 them in the project, I have to go outside of VS to edit them (and thus outside of my VS perforce control).<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span>Thoughts? Maybe I am adding them incorrectly?<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
</div>
<p class="MsoNormal"><span>-Caleb<u></u><u></u></span></p>
</div>
</div></div></blockquote></div></div></div></div><span class="HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div class="m_-247803661389720378gmail_signature" data-smartmail="gmail_signature">Sent from my iPhone 4s</div>
</font></span><br>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/<wbr>listinfo/cmake</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Eric<br></div></div></div></div></div>
</div>