<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 12 (filtered medium)">
<style><!--
/* Font Definitions */
@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;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
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;}
@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="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I need to add a custom command that varies based on configuration (with VS2010 generator). As far as I can see no direct way exists to do this.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have tried to use the $<..> syntax but it keeps quoting the expression<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">add_library (foo SHARED IMPORTED GLOBAL)<o:p></o:p></p>
<p class="MsoNormal">set_target_properties(foo PROPERTIES<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">IMPORTED_CONFIGURATIONS "Release;Debug"<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">IMPORTED_LOCATION_RELEASE “/D /E /F”<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">IMPORTED_LOCATION_DEBUG “ /A /B /C”<o:p></o:p></p>
<p class="MsoNormal">)<o:p></o:p></p>
<p class="MsoNormal">ADD_CUSTOM_COMMAND(<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">OUTPUT "${afile}.cpp"<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">COMMAND ${MY_PROGRAM} ARGS $<TARGET_FILE:foo> -c "${afile}"
<o:p></o:p></p>
<p class="MsoNormal">)<o:p></o:p></p>
<p class="MsoNormal">Results in<o:p></o:p></p>
<p class="MsoNormal">“myprogram.exe” “/A /B /C” “-c" “file.in”<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I believe I will now have to write a batch script from cmake as a helper to correctly set the correct arguments.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Has anyone else had this issue? Does anyone have a solution that worked?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Would it be possible to expand the $<…> syntax to support any cmake variable and do things like $<CMAKE_CXX_FLAGS_$<Configuration>>?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><i><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F">--</span></i></b><b><i><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F"><o:p></o:p></span></i></b></p>
<p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:#7F7F7F">Alan LaViolette</span></b><span style="font-size:9.0pt;font-family:"Times New Roman","serif""><o:p></o:p></span></p>
<p class="MsoNormal"><b><i><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F">Software Engineering Consultant</span></i></b><span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#7F7F7F"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F">OVERWATCH</span><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><o:p></o:p></span></p>
<p class="MsoNormal"><i><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F">An Operating Unit of Textron Systems</span></i><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F">21660 Ridgetop Circle, Suite 110</span><i><span style="font-size:7.5pt;font-family:"Times New Roman","serif";color:#7F7F7F"><o:p></o:p></span></i></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F">Sterling, VA 20166</span><i><span style="font-size:7.5pt;font-family:"Times New Roman","serif";color:#7F7F7F"><o:p></o:p></span></i></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F">Office: (703) 437-7651 x 2419</span><i><span style="font-size:12.0pt;font-family:"Verdana","sans-serif""><o:p></o:p></span></i></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F">Fax: (703) 437-0039</span><span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#7F7F7F"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F"><a href="mailto:alaviolette@overwatch.textron.com" title="mailto:czako@overwatch.textron.com"><i><span style="color:#7F7F7F">alaviolette@overwatch.textron.com</span></i></a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F"><a href="www.overwatch.com"><span style="color:#7F7F7F">www.overwatch.com</span></a><o:p></o:p></span></p>
<p class="MsoNormal"><b><i><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F"><o:p> </o:p></span></i></b></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:#7F7F7F">"WARNING: Documents that can be viewed, printed or retrieved from this E-Mail may contain technical data whose export is restricted by the Arms Export Control
Act (Title 22, U.S.C., Sec 2751, et seq,) or the Export Administration Act of 1979, as amended, Title 50, U.S.C., App. 2401 et seq. and which may not be exported, released or disclosed to non-U.S. persons (i.e. persons who are not U.S. citizens or lawful permanent
residents [“green card” holders]) inside or outside the United States, without first obtaining an export license. Violations of these export laws are subject to severe civil, criminal and administrative penalties."</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>