Compiling with CMake (OpenXcom)
Before building
In addition to OpenXcom dependencys, you will need CMake version 2.8.0 or superior.
CMake can be used to build OpenXcom with differents tools. So far only the Makefile and Visual Studio has been tried. Other Generator(Xcode/Code blocks, ...) might work, but if you choose to use them, we have currently no way to make sure that they work. If broken, patches are welcome to make them work.
Note : Once a project has been generated, you don't need to regenerate it after updating source. CMake will automatically check for modification and regenerate the project for you.
Source dir/build dir: CMake allow to distinguish the source directory(where the source resides) from the binary directory(where the project is generated). This allow to always have clean source directory(no left over from builds). source and binary directory can be the same, but it's generally recommanded to separate them.
Generate a build project
Using CMake GUI tool
- Launch the CMake configuration tools. First specify the path to OpenXcom source tree.
- Then specify where the OpenXcom project should be generated.
- Click on configure. The first time, CMake will ask you which kind of build tool you wish to use.
- Now CMake will analyze your system and once finished, you will be presented with a list of options. If all is fine for you, then click on generate.
Using CMake interactive command line tools ccmake is a command line tools which allow to configure the build interactively. You can launch it that way
cd "openxcom build dir" && ccmake -G 'Generator name' "path to openxcom source tree"
Generator name, is the name of the build system you whish to use. You can see possible values using the cmake help. If omitted, cmake will default to 'Unix Makefile'. Not that this needed only the first time you generate the project.
As with the GUI, tweak the options as needed and then configure the project before generating it.
Using CMake command line tools
cd "openxcom build dir" && cmake -G 'Generator name' -DOPTION_NAME=OPTION_VALUE "path to openxcom source tree"
You can check options value with:
cmake -L
To change the value of an option:
cmake -DOPTION_NAME=OPTION_VALUE "path to openxcom source tree"
Once the project is generated, you can use it as you would have done without using CMake.