The configuration file Converter.config

Assume the following folder structure

folder structure
 >> C:/projects/ESR/ExampleProject
			|_main
			|_sub1
			|_sub2
			|_tools/convert
				|_config
				   -> Converter.config
				|_templates	
				   -> CMakeTemplate.txt
				   -> template_UnitTest.txt
				   -> template_GMock.txt	
 

Example

Converter.config
    	
    {
 	Workspace = [../../.., C:/projects/ESR/ExampleProject]		# abolute or relative	
	{
	  MainProj = Workspace[0]/main					# i. e. MainProj = ../../../main	
	  BuildConfig = application
	  TemplateFile = ../templates/CMakeTemplate.txt			# relative to config file	
	  {
	      Proj2Convert = main
	      OutputFile = $$(BAKE_PROJECTDIR)/CMakeLists.txt		
	  }
	  {
	      Proj2Convert = sub1
	      OutputFile = $$(BAKE_PROJECTDIR)/CMakeLists.txt
	  }
	  {
	      Proj2Convert = sub2
	      OutputFile = $$(BAKE_PROJECTDIR)/CMakeLists.txt
	  }
	}
	{
	  BuildConfig = UnitTest
	  TemplateFile = ../templates/template_UnitTest.txt
	  GMOCK_TEMPLATE = ../templates/template_GMock.txt		# relative to config file
	  EXCLUDE_BAKE_DEPENDENCIES = [gmock, sub1]
	  EXCLUDE_BAKE_INCLUDES = [gmock]
	  {
	      MainProj = Workspace[1]/sub1				# i. e. MainProj = C:/projects/ESR/ExampleProject/sub1	
	      Proj2Convert = sub1,UnitTest
	      OutputFile = $$(BAKE_PROJECTDIR)/test/CMakeLists.txt
	  }
	  {
	      MainProj = Workspace[1]/sub2
	      Proj2Convert = sub2,UnitTest
	      OutputFile = $$(BAKE_PROJECTDIR)/test/CMakeLists.txt
	  }
	}
   }
 

The variables Workspace (-w in bake), MainProj (-m in bake), BuildConfig (-b in bake), Proj2Convert (-p in bake) are required by bake and have to be defined. Usage like in bake (see bake documentation).

OutputFile and TemplateFile are also required variables. With

OutputFile = $$(BAKE_PROJECTDIR)/CMakeLists.txt
TemplateFile = ../templates/template_libraryWithUnitTest.txt
bakeConv will be informed where the converted output file should be stored and which template file should be used. $$(BAKE_PROJECTDIR) will be replaced by bakConv automatically!

Attention about paths

Self defined variables

Examples

Self defined variables
 SpecialDependency = logger
 GMOCK_TEMPLATE = ../templates/template_gMock.txt  
 BAKE_SOURCES = []
 TEXT =	
 

Several lines from another template can be insert in the main template file by:

GMOCK_TEMPLATE = ../templates/template_gMock.txt

If one project doesn't have any source files, then an empty array

BAKE_SOURCES = []

should be defined. Otherwise $$(BAKE_SOURCES) will appear in the output file.

In general, with

TEXT =
$$(TEXT) will be replaced by a space.

Attention: The self defined variables in the config file should be of course the same as in the template file!

Filtering

If you want to filter some files e.g. gmock include files, use the following:
EXCLUDE_BAKE_INCLUDES = [gmock]
Beside this you have the possibility to filter source files and dependencies as well via EXCLUDE_BAKE_SOURCES = [...], EXCLUDE_BAKE_DEPENDENCIES = [...]. Filtering "gmock" dependency will be needed for UnitTest CMakeLists (→ Notes for UnitTest CMakeLists)

General information

With # you have the possibility to comment out a line in the config file.