saker.msvc Documentation TaskDoc JavaDoc Packages

Passing compiler/linker parameters

Sometimes you may want to directly pass some simple parameters to the backend cl.exe or link.exe. You can do that using the SimpleParameters parameter/property:

$ccompile = saker.msvc.ccompile(
	{
		Files: src/**/*.cpp,
		SimpleParameters: [ /O2 ]
	},
)
saker.msvc.clink(
	$ccompile,
	SimpleParameters: [ /LTCG ],
)

In the above we pass the /O2 argument for the compiler backed, and the /LTCG for the linker. This is in order to enable some optimizations for the compiled and linked code.

Note that you can only pass simple parameters to the compiler/linker backend. Simple parameters are the ones that does not have an argument and can be used on its own. The tasks may de-duplicate the specified simple parameters, and may reorder them.

You shouldn't specify files and other complex parameters for this option. Use the task input parameters/properties to specify them. (E.g. Use IncludeDirectories for specifying include directories instead of adding a /I parameter.)

If a parameter that you want to add is not simple, but has no corresponding task input parameter/property, then it is not currently supported by the task implementation. We're adding more and more functionality as the saker.msvc package is being developed.