Tamás Szelei
Tamás Szelei

Reputation: 23961

How can I tell premake to generate a Makefile that uses clang?

I would like to build my application using clang when generating a Makefile (gmake toolchain). Is there a way to do this?

Upvotes: 6

Views: 5866

Answers (5)

user16671917
user16671917

Reputation:

If you have premake 5, you can set the toolset option to clangin your premake5.lua

toolset "clang" in premake5.lua

Upvotes: 0

sdd
sdd

Reputation: 721

On premake5, use

#!/bin/bash
premake-5.0.0-alpha11-linux --file=PA7.lua --cc=clang --verbose gmake

--cc=clang is analogue of --platform option in premake4.

Upvotes: 4

Frank
Frank

Reputation: 2678

Here is what I use, it works for me:

--  ugly hack to use clang
premake.gcc.cc  = 'clang'
premake.gcc.cxx = 'clang++'

Nothing else seemed to work at all.

Upvotes: 6

JRL
JRL

Reputation: 83

I ultimately ended up doing what @Burton Samograd did: assign the CC environment variable. However, buried deep in the premake4 message boards they do have a way to define a new platform.

When using premake4, just invoke:

premake4 --platform=clang gmake

The only problem I've found with this is it didn't work as I expected. I'm giving my vote to Burton, but the information is here if you want it.

Upvotes: 2

Burton Samograd
Burton Samograd

Reputation: 3638

It looks like you can just set the CC varaible:

CC ?= /usr/bin/clang

in your premake file. The ?= only sets it if you haven't set it in your environment.

Upvotes: 1

Related Questions