[CMake] Non existent / new file handling

John Drescher drescherjm at gmail.com
Fri Mar 13 13:45:37 EDT 2009


On Fri, Mar 13, 2009 at 1:39 PM, Alexander Neundorf
<a.neundorf-work at gmx.net> wrote:
> On Friday 13 March 2009, John Drescher wrote:
>> Is there a way to have cmake automatically create empty missing source
>> files instead of failing?
>
> No, there is not.
>
>> Basically I when I need to add new files I add new entries to my
>> CMakeLists.txt file then I have to go to the shell and touch on each
>> file I add so that cmake will not fail to regenerate the project.
>
> Maybe you can write a macro which helps you with that. Like
> MY_ADD_EXECUTABLE(), which takes the same arguments as the normal
> ADD_EXECUTABLE(), but before handing them all over to ADD_EXECUTABLE(), check
> if each file exists and if it doesn't, create it using FILE(WRITE ...).
> But then you may get problems with files generated via ADD_CUSTOM_COMMAND().
> I would not recommend this.
>

Thanks, that sounds better than ADD_CUSTOM_COMMAND with a script to
check existence and create if needed.

John


More information about the CMake mailing list