# Programming Languages in the Wild 1) For discussion, you chose the programming language: CMake 2) This language is: Domain Specific 3) Is this language Turing complete?: Yes ## Uses 4) For what killer app, projects, or historical reason is this language best known or used?: CMake is the most popular programming tool for generating C++ build files. When compiling a C/C++ project, there are many complex platform-specific details regarding the order of commands to be run, and (when cross-compiling), which computer should run them. CMake generates build files which can then be used to build and re-build the project. Historically, CMake was the only open-source build system to target Windows, unlike autotools. CMake is used to build popular open-source projects such as KDE and MySQL, as well as being used internally at companies such as Netflix and Kitware, its creators. 5) Is the answer to 4, which the language is known for, due to language features, community support or libraries, or something else?: Compared to competitors such as Meson, autotools, Premake, and qmake, CMake is older than many others (and therefore more available), and supports more target platforms such as Windows, IOS, Android, Cray, etc. As a result, it is unlikely for a platform to not support building with CMake, so even old Linux versions can use CMake. Finally, unlike to autotools, CMake has first-class support for C++ and Windows. 6) As a programmer, what is easy to do in the language?: Because the intent of the language is to specify how a project is to be built, CMake makes it very easy to specify dependencies between different files and differnt projects. Concepts like 'producing a file from an external program at build-time' can be expressed easily, encouraging use of features outside of C/C++. 7) What does the method to do the answer to 6 look like in general purpose languages like c or java?: To produce a cross-platform dependency tree such as the one in CMake, one would likely need to write the same thing in multiple languages such as GNUmake (for Linux), NMake (for Windows), XCode (for MacOSX), MSYS make (for MSYS2), MinGW make (for mingw32), etc. Because of the major differences between these languages, writing it once in CMake means the programmer doesn't need to know 5 different languages. 8) Does the programmer have to give up anything to gain the benefits of this language?: To build a CMake project, one needs to produce a lot of files in order to do compiler version/capability testing and fast rebuilding. As a result, it is impossible to create a low-profile in-source build. Additionally, operations that may take only a few lines in make-based build systems may be much longer due to the syntax restrictions and cross-platform capabilities. This causes smaller, platform-specific programs to avoid using CMake. Ex. A tiny CMake project file may look like this: cmake_minimum_required(VERSION 3.11 FATAL_ERROR) project(testing VERSION 0.1 DESCRIPTION "Description" LANGUAGES C) add_executable(test) target_sources(test PRIVATE src/main.c) target_link_libraries(test PRIVATE ${CMAKE_DL_LIBS}) target_include_directories(test PRIVATE include) $ mkdir build $ cd build $ cmake .. $ make Versus a Unix Makefile for the same project: CFLAGS += -Iinclude LDLIBS += -ldl test: src/test.o $ make