Cute Chess moves to CMake

For the past few weeks, I’ve been working on integrating CMake support for Cute Chess. I outlined some tasks to improve the release process, and moving to CMake is prerequisite of those. Our current build system, QMake, is being slowly deprecated by the Qt Company.

The initial switch to CMake turned out to be easier than I thought — I had a working setup on Debian running after few hours of work. Many hours were wasted on the native Windows build and the default build configuration. I think both of these topics should be covered better in the official CMake documentation.

Support for QMake will remain for the source for some time, maybe until the next Cute Chess hackathon in July 2022 after which it will be removed completely.

To build Cute Chess with CMake’s default options:

mkdir build && cd build
cmake ..
make

This will build cutechess (GUI), cutechess-cli and libcutechess in release mode with debug info (-O2 -g). Dynamic linking of libcutechess is not supported. Unit tests are built by default which may change in the future. Run make test to run the tests.

If you have multiple cores on your machine, you probably want to use the Ninja backend (sudo apt install ninja-build):

mkdir build && cd build
cmake .. -G Ninja
ninja

KDAB’s Using Modern CMake with Qt proved helpful resource at the beginning of the project.