<span style="font-family: courier new,monospace;">  if(NOT EXISTS ${dependency_file})</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    #message(&quot;configuring dependency_file = ${dependency_file}&quot;)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    configure_file(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      ${empty_file}</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      ${dependency_file} IMMEDIATE)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  endif()</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  # Always include this file to force CMake to run again next</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  # invocation and rebuild the dependencies.</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  #message(&quot;including dependency_file = ${dependency_file}&quot;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  include(${dependency_file})</span><br style="font-family: courier new,monospace;">

<br>I need to include the dependency file in my CMakeLists.txt file, so that if the dependency file changes, CMake needs to rerun.  If the file doesn&#39;t exist, I need to create an empty file and include it, so that after the first build (when the dependency file is finally generated) cmake runs again to generate new build rules to incorporate the dependencies.<br>

<br>When I originally wrote this script several years ago, I had to use configure_file, because write_file() wouldn&#39;t work.  Since I&#39;m updating the script, I would like to remove the dependency on calling configure_file with a blank file (empty file).<br>

<br>James<br><br><div class="gmail_quote">On Thu, Jun 4, 2009 at 3:58 PM, Eric Noulard <span dir="ltr">&lt;<a href="mailto:eric.noulard@gmail.com">eric.noulard@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

2009/6/4 James Bigler &lt;<a href="mailto:jamesbigler@gmail.com">jamesbigler@gmail.com</a>&gt;:<br>
<div class="im">&gt; Back in the day before file(WRITE) there was write_file().  write_file() had<br>
&gt; the problem that you couldn&#39;t use the file as input to CMake, so you had to<br>
&gt; use configure_file.<br>
<br>
</div>What do you mean as &quot;input&quot;, you mean a source file in<br>
add_library or add_executable?<br>
<div class="im"><br>
&gt; Does file(WRITE) have this same restriction?<br>
<br>
</div>Don&#39;t know but I guess that now you can:<br>
<br>
set_property(SOURCE blah.h PROPERTY GENERATED TRUE)<br>
or<br>
set_source_files_properties(blah.h PROPERTIES GENERATED TRUE)<br>
<br>
I guess it should work even if blah.h is generated at CMake time.<br>
<div class="im"><br>
&gt; I currently use a blank template file for configure_file for one of my<br>
&gt; projects, and it would be nice to do away with this and just write a blank<br>
&gt; file when I need to.<br>
<br>
</div>Could you explain what do you mean by &quot;blank file&quot;?<br>
<font color="#888888"><br>
--<br>
Erk<br>
</font></blockquote></div><br>