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: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);">&lt;ToolFiles&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                   </span>&lt;ToolFile</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>RelativePath=&quot;..\..\common\mycode.rules&quot;</span><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: red;"></span><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"></span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                   </span>/&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">          </span>&lt;/ToolFiles&gt;</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: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">          </span>&lt;Configurations&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                   </span>&lt;Configuration</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>Name=&quot;Debug|Win32&quot;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>OutputDirectory=&quot;$(ConfigurationName)&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>IntermediateDirectory=&quot;$(ConfigurationName)&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>ConfigurationType=&quot;1&quot;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>InheritedPropertySheets=&quot;$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>CharacterSet=&quot;2&quot;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>&lt;Tool</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                      </span>Name=&quot;VCPreBuildEventTool&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>/&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>&lt;Tool</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                      </span>Name=&quot;VCCustomBuildTool&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>/&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>&lt;Tool</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; 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=&quot;MyCode Build Rule&quot;</span></span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                             </span>/&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; 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: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);">&lt;File</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                      </span>RelativePath=&quot;.\code.mycode&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                      </span>&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                      </span>&lt;FileConfiguration</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                </span>Name=&quot;Debug|Win32&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                </span>&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                </span>&lt;Tool</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                          </span>Name=&quot;MyCode
Build Rule&quot;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                          </span>Include=&quot;./;../../common/inc&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                          </span>Debug=&quot;true&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                          </span>Var1=&quot;10&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                          </span>Var2=&quot;52&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                          </span>AddedDependencies=&quot;code.mycode; stuff.h&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                          </span>Runtime=&quot;1&quot;</span></p>



<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                                </span>/&gt;</span></p>

<p class="MsoNormal"><span style="font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: rgb(79, 98, 40);"><span style="">                                      </span>&lt;/FileConfiguration&gt;</span></p>

<br><br>I&#39;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=&quot;./;../../common/inc&quot;<br>

  VAR Var1=10<br>  VAR Var2=52<br>  VAR AddedDependencies=&quot;code.mycode;stuff.h&quot;<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&#39;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&#39;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>