How hard would it be to augment CMake to allow custom tool files?<br><br>I would need to specify the tool file in the project:<br><br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Cjbigler%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CDOCUME%7E1%5Cjbigler%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5Cjbigler%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-alt:"Calisto MT";
        mso-font-charset:0;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-alt:"Century Gothic";
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;
        mso-font-alt:Tahoma;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:1627400839 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        font-family:"Calibri","sans-serif";
        mso-ascii-font-family:Calibri;
        mso-hansi-font-family:Calibri;
        mso-bidi-font-family:Calibri;}
.MsoPapDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><ToolFiles></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span><ToolFile</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>RelativePath="..\..\common\mycode.rules"</span><span style="font-family: "Tahoma","sans-serif"; color: red;"></span><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>/></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span></ToolFiles></span></p>
<br>Then specify it in the configuration section:<br><br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Cjbigler%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CDOCUME%7E1%5Cjbigler%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5Cjbigler%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-alt:"Calisto MT";
        mso-font-charset:0;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-alt:"Century Gothic";
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;
        mso-font-alt:Tahoma;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:1627400839 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        font-family:"Calibri","sans-serif";
        mso-ascii-font-family:Calibri;
        mso-hansi-font-family:Calibri;
        mso-bidi-font-family:Calibri;}
.MsoPapDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span><Configurations></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span><Configuration</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Name="Debug|Win32"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>OutputDirectory="$(ConfigurationName)"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>IntermediateDirectory="$(ConfigurationName)"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>ConfigurationType="1"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>CharacterSet="2"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span><Tool</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Name="VCPreBuildEventTool"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>/></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span><Tool</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Name="VCCustomBuildTool"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>/></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span><Tool</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span><span style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">Name="MyCode Build Rule"</span></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>/></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"> </span></p>
<br>Then you would need to specify this tool in the file<br><br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Cjbigler%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CDOCUME%7E1%5Cjbigler%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5Cjbigler%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-alt:"Calisto MT";
        mso-font-charset:0;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-alt:"Century Gothic";
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;
        mso-font-alt:Tahoma;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:1627400839 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        font-family:"Calibri","sans-serif";
        mso-ascii-font-family:Calibri;
        mso-hansi-font-family:Calibri;
        mso-bidi-font-family:Calibri;}
.MsoPapDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<p class="MsoNormal" style="margin-left: 1in; text-indent: 0.5in;"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><File</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>RelativePath=".\code.mycode"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span><FileConfiguration</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Name="Debug|Win32"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span><Tool</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Name="MyCode
Build Rule"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Include="./;../../common/inc"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Debug="true"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Var1="10"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Var2="52"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>AddedDependencies="code.mycode; stuff.h"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>Runtime="1"</span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span>/></span></p>
<p class="MsoNormal"><span style="font-family: "Tahoma","sans-serif"; color: rgb(79, 98, 40);"><span style=""> </span></FileConfiguration></span></p>
<br><br>I'm wondering if add_custom_command or something different could be augmented:<br><br>add_custom_command(OUTPUTS code.obj<br> VS_RULES ${path_to_rule_file}<br> VAR Include="./;../../common/inc"<br>
VAR Var1=10<br> VAR Var2=52<br> VAR AddedDependencies="code.mycode;stuff.h"<br> VAR Runtime=1<br> VAR_DEBUG Debug=true<br> VAR_RELEASE Debug=false<br> )<br><br>Would such a feature be desired by others?<br>
<br>Would this be a fit for CMake?<br><br>I could look into implementing it if there is support for such a feature.<br><br>I'm asking, because the current way to change flags on custom commands is to modify the CMakeLists.txt scripts which causes a reload loosing all the editing history (don't get me started about mixing build and editing environments !@#$!@#).<br>
<br>Another option that might be to provide the ability to add variable entries in the VS project.<br><br>add_custom_command(OUTPUT code.obj<br> COMMAND ${CMAKE_C_COMPILER} -a=$(Var1) -b=$(Var2)<br> VAR Var1=10<br> VAR Var2=52<br>
)<br><br>Then if the generator is VS it can leave the $() alone, but other generators can do the substitution.<br><br><br>James<br><br>