The Crystal Programming Language Forum

Using Cmake for Crystal

Hello,

I would like to generate a makefile for my Crystal project, using CMake. Somebody knows if it is a recommended approach and if yes, how to use CMake for generating a simple makefile compiling a Crystal executable (crystal build myprog.cr)?

Hi,

I don’t know why you want to do it.

Crystal isn’t like C, you can’t compile each .cr file into a link file, then group them. (It’s a missing feature)

A simple rule for build, start, and spec take 4 lines ;)

My Crystal project is using a C++ library that I wrote and which is using a third party library which I have as a github submodule. In order to build my C++ library I am using cmake, so I wanted my CMakeLists.txt to also generate the Crystal build, so I don’t have to maintain separate build files (although the one for Crystal is very simple).