# Introjucer: Specify Compile option based on platform

**URL:** <https://forum.juce.com/t/introjucer-specify-compile-option-based-on-platform/11151>\
**Category:** General JUCE discussion\
**Created:** [April 16, 2012, 6:55pm UTC](https://forum.juce.com/t/introjucer-specify-compile-option-based-on-platform/11151 "2012-04-16T18:55:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheVinn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thevinn/32/806_2.png) [@TheVinn](https://forum.juce.com/u/TheVinn)\
**Post date:** [April 16, 2012, 6:55pm UTC](https://forum.juce.com/t/introjucer-specify-compile-option-based-on-platform/11151/1 "2012-04-16T18:55:45Z")

</div>

It seems there is no way to indicate whether or not a file should be compiled based on the platform. For example, I have .cpp files that I want compiled only for Visual Studio targets and not Macintosh:

[attachment=0]IntrojucerFileOptions.png[/attachment]

I would like the .cpp to be compiled only for non OS X / iOS targets, and the .mm to be compiled only for OS X / iOS targets.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 17, 2012, 9:52am UTC](https://forum.juce.com/t/introjucer-specify-compile-option-based-on-platform/11151/2 "2012-04-17T09:52:29Z")

</div>

It’d be a logistical nightmare to have exporter-specific settings like that for every file, and to maintain them all when exporters are added/removed.

What I normally do is something like:

foo.mm:

`#define JUCE_IS_INSIDE_MM 1
#include "foo.cpp"`

foo.cpp:

`#if JUCE_IS_INSIDE_MM || defined (_WIN32)
...the code..
`

---

<div class="post-metadata">

**Author:** ![TheVinn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thevinn/32/806_2.png) [@TheVinn](https://forum.juce.com/u/TheVinn)\
**Post date:** [April 17, 2012, 12:41pm UTC](https://forum.juce.com/t/introjucer-specify-compile-option-based-on-platform/11151/3 "2012-04-17T12:41:18Z")

</div>

Yeah I ended up doing this as a workaround to prevent the amalgamated .cpp from causing compile errors in the Macintosh project:

.cpp

```auto
#if !defined( __APPLE__ ) || defined( __OBJC__ )
//...
```
