<p>Ok, I&#39;ll double-check this next monday. That&#39;s why I was confused.</p>
<p>On the second thought if you have a list of sources you can add them as dependencies in addition to build rule, then step will be re-run as expected. May be it&#39;s my case.</p>
<p>Anyways I need to do some more investigation.<br></p>
<p>Best wishes,<br>
Yuri</p>
<p>On Aug 12, 2011 6:54 PM, &quot;David Cole&quot; &lt;<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>&gt; wrote:<br type="attribution">&gt; You can re-open the issue if you would like to have more discussion there.<br>
&gt; <br>&gt; The build step does not always re-run. If you have an &quot;update&quot; step<br>&gt; before the build step, then the update step always re-runs, and the<br>&gt; build step after it, but many external projects do not have an update<br>
&gt; step, or anything else that &quot;always&quot; forces a build when there&#39;s a<br>&gt; &quot;Build Solution&quot; executed on the containing project. (If it does, then<br>&gt; that&#39;s a bug, because it&#39;s only supposed to re-execute steps that<br>
&gt; *need* to be re-executed.)<br>&gt; <br>&gt; <br>&gt; Thanks,<br>&gt; David<br>&gt; <br>&gt; <br>&gt; On Fri, Aug 12, 2011 at 10:46 AM, Yuri Timenkov &lt;<a href="mailto:yuri@timenkov.ru">yuri@timenkov.ru</a>&gt; wrote:<br>
&gt;&gt; Hello David,<br>&gt;&gt; It seems that I can&#39;t add notes to closed bug, so I ask you directly.<br>&gt;&gt; I don&#39;t quite understand what kind of automatic dependencies you&#39;re talking<br>&gt;&gt; about.<br>
&gt;&gt; If I change file in this way and do &quot;build solution&quot; cmake will<br>&gt;&gt; automatically launch build for external project. IIRC it always executes<br>&gt;&gt; build when I build solution.<br>&gt;&gt; As I said, for my local purposes I can use modified ExternalProject.cmake<br>
&gt;&gt; file, but I thought such feature might be useful for others.<br>&gt;&gt;<br>&gt;&gt; On Fri, Aug 12, 2011 at 5:24 PM, Mantis Bug Tracker<br>&gt;&gt; &lt;<a href="mailto:mantis@public.kitware.com">mantis@public.kitware.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt; A NOTE has been added to this issue.<br>&gt;&gt;&gt; ======================================================================<br>&gt;&gt;&gt; <a href="http://public.kitware.com/Bug/view.php?id=12322">http://public.kitware.com/Bug/view.php?id=12322</a><br>
&gt;&gt;&gt; ======================================================================<br>&gt;&gt;&gt; Reported By:                Yuri<br>&gt;&gt;&gt; Assigned To:                David Cole<br>&gt;&gt;&gt; ======================================================================<br>
&gt;&gt;&gt; Project:                    CMake<br>&gt;&gt;&gt; Issue ID:                   12322<br>&gt;&gt;&gt; Category:                   CMake<br>&gt;&gt;&gt; Reproducibility:            always<br>&gt;&gt;&gt; Severity:                   tweak<br>
&gt;&gt;&gt; Priority:                   normal<br>&gt;&gt;&gt; Status:                     resolved<br>&gt;&gt;&gt; Resolution:                 won&#39;t fix<br>&gt;&gt;&gt; Fixed in Version:           CMake 2.8.6<br>&gt;&gt;&gt; ======================================================================<br>
&gt;&gt;&gt; Date Submitted:             2011-07-08 05:27 EDT<br>&gt;&gt;&gt; Last Modified:              2011-08-12 09:24 EDT<br>&gt;&gt;&gt; ======================================================================<br>&gt;&gt;&gt; Summary:                    Ability to add source files to target created<br>
&gt;&gt;&gt; with<br>&gt;&gt;&gt; ExternalProject<br>&gt;&gt;&gt; Description:<br>&gt;&gt;&gt; In my scenario I have part of project which should be built with different<br>&gt;&gt;&gt; toolset (Main project is built with VC2010, and some legacy libraries with<br>
&gt;&gt;&gt; VC6<br>&gt;&gt;&gt; and VS2005).<br>&gt;&gt;&gt; Basically nested project contains<br>&gt;&gt;&gt; set(Proj_SRCS src1.cpp src2.cpp...)<br>&gt;&gt;&gt; add_library(Proj MODULE ${Proj_SRCS})<br>&gt;&gt;&gt;<br>
&gt;&gt;&gt; So set() command may be moved into separate file which in turn could be<br>&gt;&gt;&gt; included<br>&gt;&gt;&gt; into main project. So I want to see them there to edit in IDE, but not<br>&gt;&gt;&gt; compile.<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt; The only possibility to add files to custom target - is specify SOURCES in<br>&gt;&gt;&gt; add_custom_target command (It&#39;s impossible to call cmTarget::AddSources<br>&gt;&gt;&gt; from<br>&gt;&gt;&gt; outside). However, ExternalProject_Add macro doesn&#39;t add any sources.<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt; Moreover, there is a kind of chicken-and-egg problem: all arguments are<br>&gt;&gt;&gt; parsed<br>&gt;&gt;&gt; and set as property on target. But you can&#39;t set property while there is<br>&gt;&gt;&gt; no<br>
&gt;&gt;&gt; target.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; So as quick work-around I made private copy of ExternalProject.cmake and<br>&gt;&gt;&gt; pass<br>&gt;&gt;&gt; sources as directory property.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; So I&#39;m asking for ideas how to properly implement this feature: modify<br>
&gt;&gt;&gt; somehow<br>&gt;&gt;&gt; parameters parsing in ExternalProject, or may be introduce command which<br>&gt;&gt;&gt; allows<br>&gt;&gt;&gt; adding new sources to existing targets (I&#39;m not sure if this will work,<br>
&gt;&gt;&gt; but for<br>&gt;&gt;&gt; me it sounds like target_link_libraries command).<br>&gt;&gt;&gt; ======================================================================<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; ----------------------------------------------------------------------<br>
&gt;&gt;&gt;  (0027196) David Cole (manager) - 2011-08-12 09:23<br>&gt;&gt;&gt;  <a href="http://public.kitware.com/Bug/view.php?id=12322#c27196">http://public.kitware.com/Bug/view.php?id=12322#c27196</a><br>&gt;&gt;&gt; ----------------------------------------------------------------------<br>
&gt;&gt;&gt; I don&#39;t think we should do this.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; If we allow source files from external projects to be added directly to<br>&gt;&gt;&gt; the IDE<br>&gt;&gt;&gt; representations of the external projects in the containing project, then<br>
&gt;&gt;&gt; people<br>&gt;&gt;&gt; will expect the dependencies to work correctly automatically...<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; The dependencies will not work automatically. You will have to forcefully<br>&gt;&gt;&gt; trigger an incremental rebuild of the external project on *any* build of<br>
&gt;&gt;&gt; the<br>&gt;&gt;&gt; containing project, and then hope that its build system appropriately<br>&gt;&gt;&gt; picks up<br>&gt;&gt;&gt; only the incremental build changes necessary.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I view this as fragile, and would not like to see it go in CMake unless it<br>
&gt;&gt;&gt; can<br>&gt;&gt;&gt; be made robust, and shown to work automatically and as developers would<br>&gt;&gt;&gt; expect<br>&gt;&gt;&gt; in the vast majority of use cases.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; ----------------------------------------------------------------------<br>
&gt;&gt;&gt;  (0027197) David Cole (manager) - 2011-08-12 09:24<br>&gt;&gt;&gt;  <a href="http://public.kitware.com/Bug/view.php?id=12322#c27197">http://public.kitware.com/Bug/view.php?id=12322#c27197</a><br>&gt;&gt;&gt; ----------------------------------------------------------------------<br>
&gt;&gt;&gt; If you need more help on this issue/topic, please send email to the CMake<br>&gt;&gt;&gt; users<br>&gt;&gt;&gt; list asking for advice there. There&#39;s a much wider readership of the<br>&gt;&gt;&gt; mailing<br>
&gt;&gt;&gt; list than there is of the bug database.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Issue History<br>&gt;&gt;&gt; Date Modified    Username       Field                    Change<br>&gt;&gt;&gt; ======================================================================<br>
&gt;&gt;&gt; 2011-07-08 05:27 Yuri           New Issue<br>&gt;&gt;&gt; 2011-08-12 09:19 David Cole     Assigned To               =&gt; David Cole<br>&gt;&gt;&gt; 2011-08-12 09:19 David Cole     Status                   new =&gt; assigned<br>
&gt;&gt;&gt; 2011-08-12 09:23 David Cole     Note Added: 0027196<br>&gt;&gt;&gt; 2011-08-12 09:23 David Cole     Status                   assigned =&gt;<br>&gt;&gt;&gt; resolved<br>&gt;&gt;&gt; 2011-08-12 09:23 David Cole     Fixed in Version          =&gt; CMake 2.8.6<br>
&gt;&gt;&gt; 2011-08-12 09:23 David Cole     Resolution               open =&gt; won&#39;t fix<br>&gt;&gt;&gt; 2011-08-12 09:24 David Cole     Note Added: 0027197<br>&gt;&gt;&gt; ======================================================================<br>
&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br></p>