<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FR" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">We use CMake and among other things CMake is used for generating code at compilation time.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">We have a custom command like so:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">add_custom_command(OUTPUT O0, O1, O2…On<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">                   launch-generation-command<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">                   DEPENDS I0, I1, I2, ….In<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">   VERBATIM)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">So there are multiple inputs and multiple outputs (why not launch the command for each input and have only one output? – it would take too much time combined, a jvm is launched every time and there are a lot of generated
 files).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The command that is launched is intelligent enough to not touch output if its corresponding input has not changed.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Now I’m coming to the problem: when I touch an input Ix, I expect that output Ox is regenerated. That works great, make will launch the custom command and Ox will be generated and compiled afterwards. But, subsequent
 runs of make will still launch the custom command which is not ok. By digging in the generated Makefiles I see that cmake will hang the custom command under one of the outputs (arbitrarily?). If that output is not exactly the input that I touch, given that
 the generator will only output code for what has really changed, the target will always be invalid and make will always launch the custom command. Is there a solution for this?
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">It seems obvious to me that if the oldest output is more recent than the newest input then the custom command shouldn’t be called.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Visual Studio is even worse. Besides launching the custom command every time, it will recompile all outputs because, my guess is that after the custom command has run it won’t even bother to check that the .obj is more
 recent than the corresponding .cpp.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Sorry for the somewhat terse mail and thanks in advance!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Cosmin<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="ecxMsoNormal" style="line-height: 19px; margin: 0px 0px 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: #2a2a2a; ">*******************************</p><p class="ecxMsoNormal" style="line-height: 19px; margin: 0px 0px 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; color: #2a2a2a; "><span lang="EN-GB" style="line-height: 17px; font-size: 10pt; color: black; font-family: Arial; ">This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. </span><span style="font-family: Arial" color="black" size="2"><span style="line-height: 17px; font-size: 10pt; ">Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.</span></span></p></body>
</html>