Cog's presence detection

We will use my ObjectTags plugin as an example.

Inside of the build.cs file, you'll find this code:

This code will enable or disable the COG_INSTALLED preprocessor macro depending of the Cog plugin can be found inside the Plugins folder and add it as a dependency if it's found.

This setup enables us to write Cog dependend code, which is disabled and ignored by the IDE and compiler if the Cog plugin is disabled.

In the code example above, if Cog is missing, the code will automatically be disabled and not recognized by the IDE. Thus, not causing any errors and allowing you to continue using the plugin.

In some cases, you might have to wrap #include's with the #if COG_INSTALLED preprocessor macro, then use #if ENABLE_COG.

Last updated