Building an ArrayFire program with CMake

Brian KloppenborgArrayFire 5 Comments

Introduction In the last week there were a few questions about how to use ArrayFire with CMake on Linux on the ArrayFire Google Groups page. Although we have some quick notes about this in the documentation I thought it would be fun to provide a fully worked example that demonstrates a cool CMake trick to reduce compilation time by a factor of three when linking against multiple backends. At the bottom of this post is a link to a GitHub repository containing a minimal CMake project setup which links a program against ArrayFire’s CPU, OpenCL, and CUDA backends.