[Feature Request] CMakeLists.txt include user provided file

If one could include a file (optional) in the generated CMakeLists.txt it would be possible to make own modifications for includes, defines, or even finding mono. Currently it is not really possible to generate proper Eclipse CDT project files because some flags are missing. If you add those they are of course lost whenever you regenerate the cmake files.

find_program(MONO_EXECUTABLE mono)
	message(FATAL "No mono installation found in your path")


So something like:

if (EXISTS "somename.cmake")

would be awesome.

You should place those modifications in build scripts which UBT use to generate CMakeLists, there is no documentation on them it kind of hard to figure how they work, but in case of definitions, first create this function in target build script (ProjectNameEditor.Target.cs, or without editor for packaged game build):

public override void SetupGlobalEnvironment(
		TargetInfo Target,
		ref LinkEnvironmentConfiguration OutLinkEnvironmentConfiguration,
		ref CPPEnvironmentConfiguration OutCPPEnvironmentConfiguration

And then inside it:

OutCPPEnvironmentConfiguration.Definitions.Add("NAME_OF_DEFINITION=1"); // or 0 if you want to disable definition

Best place to learn what you can do in build scripts, as always whern there lacks in docs, is engine source code. Each tool has *.Target.cs and each UE4 module has *.Build.cs

Thanks, that would of course work for defines and includes, but it doesn’t work for e.g. the above example of cmake script stuff that I’ve posted. The point is that I usually use cmake to generate project files for my IDEs, and therefore I need to be able to tweak things.

This pull request also implements this feature request: https://github.com/EpicGames/UnrealEngine/pull/1668