Feature request: cmake build target


#1

One thing I've been wanting for a long time in the Introjucer is the ability to have it generate a cmake project rather than (or rather, in addition to) project files for specific IDE's. This may seem to be a bit redundant, since Introjucer and cmake essentially serve the same purpose -- to generate build files for a specific platform. However supporting cmake as a build target would have a number of advantages:

  • You can specify preprocessor definitions once, and cmake will figure out how to translate them into the correct syntax needed by the compiler. With Introjucer you need to specify the same definitions in each platform, copy/pasting as needed.
  • You would have access to build settings which Introjucer does not directly support. For instance, on Mac OSX, it is useful to be able to set the minimum supported version, which is stored in the Xcode project file and overwritten every time you re-generate the Xcode project with Introjucer.
  • Cmake is really good at supporting tons of different IDE's, including new versions of Visual Studio and Xcode which tend to break builds.
  • No more keeping enormous XML files for several IDE's in version control!
  • Support for many more build systems, such as nmake on Windows and ninja on Unix.
  • Easier integration with third-party submodules or other dependencies.
  • Many IDE's (such as QT creator and NetBeans) provide native support for reading CMakeLists.txt files, so you wouldn't need to generate a project file to use these tools.

I'd be happy to contribute a patch, but I'm hesitant to start working on such a patch if I know that it would not be accepted and merged. What's the general feeling on cmake support for Introjucer?


#2

The reason I wrote the introjucer in the first place was that I was using cmake and hated it! This'd be a huge pain for me to maintain, since I wouldn't use it myself, so it's not something I'd be particularly keen to do.

And I think that to produce a cmake file that replicates all the existing functionality for every platform and target-type would probably be messy to write. If you're willing to contribute some time, then my gut feeling is that it'd probably be more efficient to spend it tweaking or extending the introjucer to do whatever it is that you feel is lacking. E.g. you mentioned setting the minimum supported version in Xcode, and to add a setting for that would probably only take 5 minutes.

Actually, an interesting avenue now that we have a javascript interpreter is that it'd be interesting to allow projects to contain scripts that can modify the target files directly, e.g. adding a custom Xcode or Visual studio flag.


#3

It seems that cmake is somewhat devisive; either people love it or hate it (I'm personally rather neutral about it, but I find it to be useful). Anyways as I don't feel like maintaining a branch of juce for this feature alone, I'll probably take your advice and try to patch Introjucer to fix the Xcode things that I need, given that this is the platform which seems to require the most post-Introjucer maintainance for my projects. Anyways, I'll start a separate thread for my thoughts on that topic. Thanks for the direct and fast feedback!