Categories
Mastering Development

Installing only clang and cmake, CMake was unable to find a build program corresponding to “Unix Makefiles”. CMAKE_MAKE_PROGRAM is not set

I’m trying to use clang with CMake. Here’s my Dockerfile. You can see that I did not install build-essentials, only clang, because I dont want GNU compilers to be made default.

My Dockerfile:

FROM ubuntu:bionic

WORKDIR /home/project

RUN export DEBIAN_FRONTEND=noninteractive && apt-get update\
    && apt-get install -y clang wget

RUN wget https://github.com/Kitware/CMake/releases/download/v3.18.0-rc2/cmake-3.18.0-rc2-Linux-x86_64.sh && ls

RUN mkdir -p /usr/local/cmake \
&& chmod +x cmake-3.18.0-rc2-Linux-x86_64.sh \
&& ./cmake-3.18.0-rc2-Linux-x86_64.sh --skip-license --prefix=/usr/local/cmake

ENV PATH="/usr/local/cmake/bin:${PATH}"

CMakeLists.txt

cmake_minimum_required (VERSION 3.10)
project(libsmoltcp_cpp LANGUAGES CXX)

Here’s what I get when running cmake .:

root@275dbeaae123:/home/project# cmake .
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "/home/project/CMakeFiles/CMakeOutput.log".

In update-alternatives there’s just clang:

root@275dbeaae123:/home/project# update-alternatives --config cc
There is only one alternative in link group cc (providing /usr/bin/cc): /usr/bin/clang
Nothing to configure.

Leave a Reply

Your email address will not be published. Required fields are marked *