CMake build system for openFrameworks. Usage of the CLion IDE is possible
Forks
Forks pushed to more recently than peterkolski/ofxCMake itself, plus any admin-confirmed fork with commits of its own — worth checking if you're hitting issues with the original.
ofxyz/ofxCMake
TheTechnobear/ofxCMake
mm318/ofxCMake
visualcamp-legacy/ofxCMake
techtim/ofxCMake
gilbertfrancois/ofxCMake
koreus7/ofxCMake
mursisoy/ofxCMake
Branches ahead of master
These branches have commits not yet on master — could be unmerged fixes or work in progress worth a look.
README

CMake for OpenFrameworks [Vers. 0.1]
Quick Start Guide
1. Clone intoof/addons/ofxCMake 2. In ofxCMake/project/CMakeLists.txt change the path of your OF folder. 3. Copy ofxCMake/project/CMakeLists.txt into your project folder 4. Open with CLion or compile via terminalDiscription
CMake is a meta build system, so it can generate different build systems like Visual Studio Projects, xCode, make etc. It can also create installers like DEB, RPM and MSI.CMake Intro:
CMake is a universal, plattform independent build system. It tells which source files and libraries of OpenFrameworks, your project and addOns have to be compiled together so you have your application. CMake is supported e.g. by the IDEs: CLion, QTCreator, KDevelop.
Note
This is not an ofxAddOn in the normal way. So do not just copy it into theof/addons/ folder and expect it to work.Installation
1. Clone the git files in your openframeworks addon folder $ cd of/addons
$ git clone https://github.com/BildPeter/ofxCMake.git
Alternative: Extract in of/addons and rename into ofxCMake 2. In the file ofxCMake/project/CMakeLists.txt change the path of your OF folder. Usage
Preperation
- Copy the file
ofxCMake/project/CMakeLists.txtinto the folder of your openframeworks project
- Optional:
- [If not done before] In this
CMakeLists.txt: adjust the path of your OF folder. - If you have more source files than the standard
main.cpp,ofApp.cpp– be sure to include them in the section "Source Files" - Change name of your application
APP_NAME
Command Line Compilation
- Create a new directory in your project folder – e.g.:
mkdir build - Go into that folder
- type
cmake .. - Compile:
make(optional-j4to compile with 4 cores)
$ cd of/apps/myApps/newApp
$ mkdir build
$ cd build
$ cmake ..
$ make -j4
- Generate IDE files: e.g. for xCode
cmake -G Xcode ..
CLion IDE
1. Prepare your project as explained above 2. Choose via CLion in the 'Open File or Project' theCMakeLists.txt- A promt might ask, if you want to change the 'project root'. Ignore this
- In git, the CLion project files will be saved in a '.idea' folder. If you want, you can ignore that in GIT.
Addons
Internal Addons – Usage
- Uncomment the internal addOn, you want to use in the
CMakeLists.txtof your project
External Addons – Creation
- Create an addon-file
ofxNAME.cmakefrom the templates inofxCMake/addOns - Copy the file into
ofxCMake/addOns/external - Add the path to the file
ofxCMake/modules/addOnsExternal.cmake– like e.g.
include( ${OF_CMAKE_ADDONS}/external/ofxNAME.cmake ) - Add the name of your addOn into your projects
CMakeLists.txtin the sectionAddOns
Development Philosophy
- The project file
CMakeLists.txtis simplified for readability. - A modular file approach (each OS has it's own .cmake files), so understanding of the code and version control is easier
- Having all ofxCMake files in one folder (including addOns) has the advantage:
- Can easily be installed
- OpenFrameworks can be updated, without having to do changes in the openframeworks and the CMake folders
- Down sides:
- The addOn files are not placed in the addOns itself (but in
of/addons/). It would be better, if each addOn has it's .cmake file already included. But this would mean, that the developer deliver it in their source code.
Compatibility
At the moment (Feb 2017) only Mac OS is fully tested.The infrastructure for other OS (Linux, Windows) is already set up.
Tested on MacOS 10.12.2 with cMake 3.2.1 and of 0.9.8
ofxAddons