<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Courier;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@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:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.p1, li.p1, div.p1
        {mso-style-name:p1;
        margin:0in;
        margin-bottom:.0001pt;
        background:#13773E;
        font-size:9.0pt;
        font-family:Courier;
        color:#FFF0A5;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.s1
        {mso-style-name:s1;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">I found “add_file_dependencies” and now I’ve got this working<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">    include(AddFileDependencies)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">    FOREACH( PS_FILE <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            macrmenc.ps<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            winenc.ps<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        )<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        string(REGEX REPLACE "^(.+)\.ps$" "\\1\.nps" NPS_FILE  ${PS_FILE} )<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        set(PS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/PDCore/ProcSet/${PS_FILE}")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        add_custom_command(OUTPUT ${NPS_FILE}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                           COMMAND sed -f ${CMAKE_SOURCE_DIR}/pdfl/PDF/Build/Toolkit/dl-cmake/quotit.sed ${PS_PATH} > ${CMAKE_CURRENT_BINARY_DIR}/${NPS_FILE}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                           MAIN_DEPENDENCY ${PS_PATH}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                           COMMENT "Generating ${NPS_FILE} from ${PS_FILE}"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                           VERBATIM )<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        add_file_dependencies(../../../Source/PDCore/ProcSet/Unix/ProcSetsUnix.cpp  ${CMAKE_CURRENT_BINARY_DIR}/${NPS_FILE})<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">    ENDFOREACH()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">    <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black">CMake <cmake-bounces@cmake.org> on behalf of Rob Boehne <robb@datalogics.com><br>
<b>Date: </b>Thursday, October 18, 2018 at 1:29 PM<br>
<b>To: </b>"cmake@cmake.org" <cmake@cmake.org><br>
<b>Subject: </b>[SPAM] [CMake] Generated header dependency problem<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt">All,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I have some files that get “sed” run on them, and that output is written to a file with the suffix “nps”</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">These files are #included by a C++ source file listed as a source for a library in the same CMakeLists.txt</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">The documentation suggests that the dependency the .cpp file has on the generated include files will be handled automatically – but I don’t see any reference to them in the generate Makefile (except in CXX.includecache)</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Here is the section of CMakeLists.txt that generates the files:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">    set(SED_CMD  "sed -e 's/\"/\\\\\"/g'  -e 's/\\(.*\\)/\"\\1\\\\n\"/'" )</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">    FOREACH( PS_FILE </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            macrmenc.ps</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">            winenc.ps</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        )</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        string(REGEX REPLACE "^(.+)\.ps$" "\\1\.nps" NPS_FILE  ${PS_FILE} )</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        set(PS_PATH "../../../Source/PDCore/ProcSet/${PS_FILE}")</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">        add_custom_command(OUTPUT ${NPS_FILE}</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                           COMMAND  ${SED_CMD}</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                           MAIN_DEPENDENCY ${PS_PATH}</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                           VERBATIM )</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">    ENDFOREACH()</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">My question is, How do I get the source file that includes these to cause them to be generated?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">In other words, why doesn’t the C++ scanner see that a file named “winenc.nps” is included but is not present and generate it from “winenc.ps” ?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I’m using CMake 3.12.1 and the Makefile generator, and the symptom is that everything builds up to the point where the CPP file that includes “winenc.nps” is compiled, and that fails with:</span><o:p></o:p></p>
<p class="p1"><span style="font-size:11.0pt">   </span><span class="apple-converted-space"> </span><span class="s1">error: winenc.nps: No such file or directory</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">TIA,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Rob</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="392" style="width:293.8pt;margin-left:-5.4pt;border-collapse:collapse">
<tbody>
<tr style="height:66.75pt">
<td width="101" style="width:76.0pt;padding:0in 5.4pt 0in 5.4pt;height:66.75pt">
<p class="MsoNormal" align="center" style="text-align:center;text-autospace:none">
<span style="font-size:11.0pt"><img width="87" height="87" style="width:.9062in;height:.9062in" id="Picture_x0020_1" src="cid:image001.png@01D466F4.BE6A5500" alt="cid:image002.png@01D3D0E3.DCFE6710"></span><o:p></o:p></p>
</td>
<td width="290" style="width:217.8pt;padding:0in 5.4pt 0in 5.4pt;height:66.75pt">
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#E83C21">Rob Boehne</span></b><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Senior Software Architect | Datalogics, Inc.</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt"><a href="tel:(312)%20853-8351"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#0B4CB4">+1.312.853.8351</span></a></span><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> | <a href="mailto:robb@datalogics.com"><span style="color:#0B4CB4">robb@datalogics.com</span></a></span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt"><a href="http://www.datalogics.com/"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#0B4CB4">datalogics.com</span></a></span><span style="font-size:10.0pt;font-family:"Arial",sans-serif"> | <a href="http://blogs.datalogics.com/"><span style="color:#0B4CB4">blogs.datalogics.com</span></a></span><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Connect with us: <a href="https://www.facebook.com/DatalogicsInc"><span style="color:#0B4CB4">Facebook</span></a> | <a href="https://twitter.com/DatalogicsInc"><span style="color:#0B4CB4">Twitter</span></a> | <a href="https://www.linkedin.com/company/datalogics?actionToken=p=p%3Dbiz-company-login%26c%3D3217e65a-bdc2-4b38-8f9c-13c982e8c529%26m%3Dcompany_feed%26n%3D0&t=a%3DisFolloweeOfPoster%253Dfalse%2526distanceFromActor%253D-1%2526actorType%253D%2526likedByUser%253Dfalse%2526targetId%253D%2526recentCommentUrns%253D%2526targetType%253D%2526sponsoredFlag%253DORGANIC%2526verbType%253Dlinkedin%25253Ashare%2526objectType%253Dlinkedin%25253Aarticle%2526totalShares%253D0%2526activityId%253Durn%25253Ali%25253Aactivity%25253A6263731876121362433%2526recentLikerUrns%253D%2526actorId%253Durn%25253Ali%25253Acompany%25253A14000%2526totalComments%253D0%2526relevanceScore%253D0.0%2526recentCommenterUrns%253D%2526isPublic%253Dtrue%2526time%253D-1%2526totalLikes%253D0%2526objectId%253Durn%25253Ali%25253Aarticle%25253A7793179909183391510%2526distanceFromNestedActor%253D-1%26s%3DORG"><span style="color:#0B4CB4">LinkedIn</span></a> | <a href="https://www.youtube.com/user/Datalogics"><span style="color:#0B4CB4">YouTube</span></a></span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</body>
</html>