# Request for Narrower Module Including (to improve build times and avoid whole-project recompilations)

**URL:** <https://forum.juce.com/t/request-for-narrower-module-including-to-improve-build-times-and-avoid-whole-project-recompilations/21140>\
**Category:** The Projucer\
**Created:** [February 27, 2017, 2:45pm UTC](https://forum.juce.com/t/request-for-narrower-module-including-to-improve-build-times-and-avoid-whole-project-recompilations/21140 "2017-02-27T14:45:33Z")\
**Posts on this page:** 2\
**Page:** 1

<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:** [February 27, 2017, 2:45pm UTC](https://forum.juce.com/t/request-for-narrower-module-including-to-improve-build-times-and-avoid-whole-project-recompilations/21140/1 "2017-02-27T14:45:33Z")

</div>

I posted this at the end of this thread but it may have been lost in there and I think it deserves a request in its own right: [How to Include an Entire Source Tree](https://forum.juce.com/t/how-to-include-an-entire-source-tree/14285/9)

I’m a big fan of the module format, apart from it being a really easy way to include code across projects, it quietly promotes a much better coding style of separating components and programming in a more generic, library orientated way.

However, the whole project re-builds can be annoying when you’re simply modifying some inlined methods or do a git-pull etc.

I’ve been wondering if there is way modules can be included on a more opt-in basis and I don’t think this would be too hard to do.  
• In the Projucer you’d just have a box next to the module that you could tick to “Generate separate header”  
• If this is ticked it wouldn’t get added to `JuceHeader.h` but it’s own file would be created that looked like below:

```
module_name.h

#pragma once
#include "AppConfig.h"
#include <module_name/module_name.h>

```

• Then, in your app code you could simply include the module where required, like you would boost or the STL. E.g. `#include <module_name.h>`  
• The search path would already be included because it’s within `/JuceLibraryCode/`  
• The `JUCE_MODULE_AVAILABLE_module_name` is still defined in `AppConfig.h`  
• An eventually we could ditch this an use C++17’s `__has_include (<module_name.h>)`

I think this should work but I’ve not fully tested it yet. Can anyone spot any obvious holes?

---

<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:** [February 27, 2017, 2:50pm UTC](https://forum.juce.com/t/request-for-narrower-module-including-to-improve-build-times-and-avoid-whole-project-recompilations/21140/2 "2017-02-27T14:50:29Z")

</div>

Yes - sounds like a nice idea!

(Am really looking forward to `__has_include`, that could be used for some really cool compile tricks)
