# File-Specific Complier Flags

**URL:** <https://forum.juce.com/t/file-specific-complier-flags/15316>\
**Category:** The Projucer\
**Created:** [August 13, 2015, 3:53pm UTC](https://forum.juce.com/t/file-specific-complier-flags/15316 "2015-08-13T15:53:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![LukeM](https://avatars.discourse-cdn.com/v4/letter/l/f04885/32.png) [@LukeM](https://forum.juce.com/u/LukeM)\
**Post date:** [August 13, 2015, 3:53pm UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/1 "2015-08-13T15:53:17Z")

</div>

Hi Jules & Team!

&nbsp;

I've hit a bit of a problem with the Jucer overwriting some settings in Visual Studio.

I need to set some file-specific Command Line Additional Options which are just getting removed whenever the IntroJucer resaves the project.

Any chance of adding support for this to the IntroJucer? It would drastically speed up my build times!!

&nbsp;

Thanks,

Luke.

---

<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:** [August 17, 2015, 10:36am UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/2 "2015-08-17T10:36:48Z")

</div>

Sorry, as we've discussed on here many times, it'd just be too much of a technical pain for us to attempt to sync with changes that you've made directly in an IDE. If you want to suggest modifications to the Introjucer that would generate the extra project settings that you need, then that's something we'd be open to.

---

<div class="post-metadata">

**Author:** ![LukeM](https://avatars.discourse-cdn.com/v4/letter/l/f04885/32.png) [@LukeM](https://forum.juce.com/u/LukeM)\
**Post date:** [August 17, 2015, 1:23pm UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/3 "2015-08-17T13:23:32Z")

</div>

Syncing with IDE changes really would be a pain! The ability to add those settings in the IntroJucer was actually what I meant in the original post..

I can take a look at the IntroJucer code and see if I can make the changes myself.

---

<div class="post-metadata">

**Author:** ![trickyflemming](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@trickyflemming](https://forum.juce.com/u/trickyflemming)\
**Post date:** [August 30, 2015, 5:02pm UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/4 "2015-08-30T17:02:26Z")

</div>

I second this feature request. Not syncing with VS, but rather being able to add a flag to individual files.

For instance, we have a third-party .rc file in our Windows projects. Every time we save a project with Introjucer, we need to remember to find the file, right-click, select properties, and change "Item Type" to "Resource Compiler". It would save a lot of time and prevent absent-minded accidents if Introjucer supported this.

---

<div class="post-metadata">

**Author:** ![adamwilson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/adamwilson/32/1387_2.png) [@adamwilson](https://forum.juce.com/u/adamwilson)\
**Post date:** [September 1, 2015, 6:11pm UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/5 "2015-09-01T18:11:56Z")

</div>

If you know what the change looks like in the relevent config files, its worth having a go at putting this into Introjucer yourself and sending a patch to the JUCE team. I've done this in recent past for certain Android settings. Have a look in the Project Saving folder for the relevant file and code.

---

<div class="post-metadata">

**Author:** ![goodhertz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/goodhertz/32/74_2.png) [@goodhertz](https://forum.juce.com/u/goodhertz)\
**Post date:** [November 16, 2016, 7:36am UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/6 "2016-11-16T07:36:51Z")

</div>

Are file-specific compiler flags still not possible in Juce? We have a couple sources that require different optimization flags and can’t seem to find a suitable workaround.

---

<div class="post-metadata">

**Author:** ![martinrobinson-2](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/martinrobinson-2/32/630_2.png) [@martinrobinson-2](https://forum.juce.com/u/martinrobinson-2)\
**Post date:** [November 16, 2016, 8:58am UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/7 "2016-11-16T08:58:25Z")

</div>

I had the same issue when playing with the fast-math compiler flags since I was using sqlite and it specifically wouldn’t work with that optimisation. I ended up putting sqlite in separate static lib, and since sqlite is quite big it improved build times too. I know that may not help for your use case but if it’s parts of the codebase that change infrequently it may be useful.

---

<div class="post-metadata">

**Author:** ![goodhertz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/goodhertz/32/74_2.png) [@goodhertz](https://forum.juce.com/u/goodhertz)\
**Post date:** [November 16, 2016, 9:12am UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/8 "2016-11-16T09:12:42Z")

</div>

Thanks! That’s helpful. It might not be ideal since debugging will be tougher but seems like a workable option.

---

<div class="post-metadata">

**Author:** ![john\_henry](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/john_henry/32/560_2.png) [@john\_henry](https://forum.juce.com/u/john_henry)\
**Post date:** [October 17, 2017, 8:51pm UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/9 "2017-10-17T20:51:19Z")

</div>

Bumping this request again. We have a 3rd party library, that we don’t have control over, added into Projucer as Source Code. We want to disable warnings for these specific files by adding in -W flags. Please add file specific compiler flags into Projucer, at least for XCode and VS.

There seem to be many useful application cases.

Thanks!

---

<div class="post-metadata">

**Author:** ![dave96](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/dave96/32/8487_2.png) [@dave96](https://forum.juce.com/u/dave96)\
**Post date:** [October 17, 2017, 8:57pm UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/10 "2017-10-17T20:57:09Z")

</div>

You could always include all the 3rd party files in your own file and use pragmas to turn warnings off. This is done in some JUCE code which includes other libs. Grep for `#pragma warning (disable`.

This can be difficult however if the warnings are in headers as some flags can’t be turned back on once disabled…

---

<div class="post-metadata">

**Author:** ![john\_henry](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/john_henry/32/560_2.png) [@john\_henry](https://forum.juce.com/u/john_henry)\
**Post date:** [October 17, 2017, 9:09pm UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/11 "2017-10-17T21:09:14Z")

</div>

Thanks, I know JUCE includes cpp files a lot for its modules, but including cpp files seems like the wrong approach for the actual project. I would need to manually disable compiling these library cpp files in the projucer and then include them into one common cpp file, that seems not like the right approach.

---

<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:** [October 18, 2017, 7:39am UTC](https://forum.juce.com/t/file-specific-complier-flags/15316/12 "2017-10-18T07:39:32Z")

</div>

You could also turn _off_ compiler warnings globally for the whole project, but if you have a global header file which all your own files include, you could add pragmas in there to turn _on_ all the warnings you want for your own stuff.
