[CMake] VS ToolFile

James Bigler jamesbigler at gmail.com
Thu Mar 4 12:14:13 EST 2010


How hard would it be to augment CMake to allow custom tool files?

I would need to specify the tool file in the project:

<ToolFiles>

                   <ToolFile

                             RelativePath="..\..\common\mycode.rules"

                   />

          </ToolFiles>

Then specify it in the configuration section:

          <Configurations>

                   <Configuration

                             Name="Debug|Win32"

                             OutputDirectory="$(ConfigurationName)"

                             IntermediateDirectory="$(ConfigurationName)"

                             ConfigurationType="1"


InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"

                             CharacterSet="2"

                             >

                             <Tool

                                      Name="VCPreBuildEventTool"

                             />

                             <Tool

                                      Name="VCCustomBuildTool"

                             />

                             <Tool

                                      Name="MyCode Build Rule"

                             />



Then you would need to specify this tool in the file

<File

                                      RelativePath=".\code.mycode"

                                      >

                                      <FileConfiguration

                                                Name="Debug|Win32"

                                                >

                                                <Tool

                                                          Name="MyCode Build
Rule"


Include="./;../../common/inc"

                                                          Debug="true"

                                                          Var1="10"

                                                          Var2="52"


AddedDependencies="code.mycode;
stuff.h"

                                                          Runtime="1"

                                                />

                                      </FileConfiguration>


I'm wondering if add_custom_command or something different could be
augmented:

add_custom_command(OUTPUTS code.obj
  VS_RULES ${path_to_rule_file}
  VAR Include="./;../../common/inc"
  VAR Var1=10
  VAR Var2=52
  VAR AddedDependencies="code.mycode;stuff.h"
  VAR Runtime=1
  VAR_DEBUG Debug=true
  VAR_RELEASE Debug=false
  )

Would such a feature be desired by others?

Would this be a fit for CMake?

I could look into implementing it if there is support for such a feature.

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 !@#$!@#).

Another option that might be to provide the ability to add variable entries
in the VS project.

add_custom_command(OUTPUT code.obj
  COMMAND ${CMAKE_C_COMPILER} -a=$(Var1) -b=$(Var2)
  VAR Var1=10
  VAR Var2=52
  )

Then if the generator is VS it can leave the $() alone, but other generators
can do the substitution.


James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100304/fc0105e8/attachment.htm>


More information about the CMake mailing list