Native: how get the targetPlatform in a tasks.withType(RunTestExecutable)

Hi
I am running C++ unit tests with a customized RunTestExecutable as for example for Windows

	tasks.withType(RunTestExecutable) {
		String PATH = System.getenv("PATH")
		String name = getName();
		if (name.contains('Win32')) {
			PATH = "$rootDir\\bin;$PATH"
			PATH = "$rootDir\\openssl\\build\\win32\\bin\\release;$PATH"
			PATH = "$rootDir\\openssl\\build\\win32\\bin\\debug;$PATH"
			PATH = "$mysql32Home".replace('/','\\') + "\\bin;$PATH"
			PATH = "$postgres32Home".replace('/','\\') + "\\bin;$PATH"

		} else
		if (name.contains('Win64')) {
			PATH = "$rootDir\\bin64;$PATH"
			PATH = "$rootDir\\openssl\\build\\win64\\bin\\release;$PATH"
			PATH = "$rootDir\\openssl\\build\\win64\\bin\\debug;$PATH"
			PATH = "$mysql64Home".replace('/','\\') + "\\bin;$PATH"
			PATH = "$postgres64Home".replace('/','\\') + "\\bin;$PATH"
		}

		environment "Path", "$PATH"
}
 The target platform is computed from the name of the task which is quite bad. So my question is: How can a task get the targetPlatform in a clean and independant from the task's name way?