<div dir="ltr">Thanks for the quick response, Brad.<br><br>On 11 April 2017 at 17:52, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com" target="_blank">brad.king@kitware.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 04/11/2017 11:41 AM, Petr Kmoch wrote:<br>
> Currently, adding a new source file to a CMake-controlled project<br>
> means doing two things: creating the file on disk, and adding it<br>
> to the relevant CMakeList add_library() or add_executable() call.<br>
<br>
</span>I view this as a matching pair with an implicit sanity check.<br></blockquote><div><br></div><div>I sometimes have very deep directory hierarchies (files are 3+ directory levels below the CMakeLists.txt), with interface header, implementation header, and implementation source in three different paths down that hierarchy. Adding one class means adding three very similar lines of CMake code, and then having to navigate three separate directory paths for adding the files.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> switch from current behaviour of "error out if source file is not found"<br>
> to "create empty source file if it's not found."<br>
<br>
</span>So a typo in the `CMakeLists.txt` file leads to silent creation of a<br>
source file instead of an error message?<br></blockquote><div><br></div><div>That's why I would make it strictly opt-in. We could even get rid of the initialisation variable and keep it under full control of the project.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
That said, I can see how the proposed feature might be useful when<br>
iteratively developing in an IDE.  Add the file to `CMakeLists.txt`,<br>
reconfigure, and open the new (now existing) file to edit in the IDE.<br></blockquote><div><br></div><div>Yes, I'm coming from an IDE background (VS, to be precise). It would be quite helpful there. I've bounced the idea with other people in my team, and they agreed it would be useful.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> Is this something that would be acceptable into CMake? Any comments?<br>
<br>
</span>I'd like to hear more opinions from others before considering it<br>
upstream.  It feels like a pretty personal workflow right now, and<br>
can be implemented in CMake code already (perhaps with the `SOURCES`<br>
target property to avoid separate lists).<br>
<br>
If this were to be done I'd first like to see a policy introduced to<br>
get rid of the magic extension guessing we do now.  Without knowing<br>
the full file name with confidence we wouldn't be able to create it.<br></blockquote><div><br></div><div>I'm perfectly fine waiting for broader comments. As to extension guessing, right now the creation happens after that step in my prototype code, and simply uses the name verbatim as supplied. I'm perfectly willing to create such a guess-disabling policy, though. I've never used the guessing functionality anyway.<br><br></div><div>Petr<br></div></div></div></div>