# Defining a Macro / Preprocessor Directive for a specific build target

**URL:** <https://forums.unrealengine.com/t/defining-a-macro-preprocessor-directive-for-a-specific-build-target/1255801>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [August 9, 2023, 3:57pm UTC](https://forums.unrealengine.com/t/defining-a-macro-preprocessor-directive-for-a-specific-build-target/1255801 "2023-08-09T15:57:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RRI\_DAVID](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rri_david/32/751252_2.png) [@RRI\_DAVID](https://forums.unrealengine.com/u/RRI_DAVID)\
**Post date:** [August 9, 2023, 3:57pm UTC](https://forums.unrealengine.com/t/defining-a-macro-preprocessor-directive-for-a-specific-build-target/1255801/1 "2023-08-09T15:57:36Z")

</div>

I’m attempting to create a new build target for my game that will produce a client with extra “stuff” added i.e. I want to define a macro/preprocessor directive which I can use to #if include code in this build only. To this end I have created a new \*.Target.cs file.

I have attempted to define my macro by adding `GlobalDefinitions.Add("MY_MACRO=1")` to my \*.target.cs file, but this does not appear to be picked up by Visual Studio.

I have been able to add a macro to my \*.build.cs file using `PublicDefinitions.add("MY_MACRO=1")`, which _is_ picked up by Visual Studio, but this is then _always_ defined (not only when I select my desired target).

Am I going about this in the wrong way?
