Set clang as default compiler

Hello, how can I set clang compiler as a default in manjaro?

Add export CC=clang and (for C++) export CXX=clang++ to your /etc/makepkg.conf

https://wiki.archlinux.org/index.php/Clang

2 Likes

thank you, okay I did it. But can you please help me, how can I check that this option is working for now?

well, even after this set options. Cmake generate make files with GCC compiler as default. I suppose this is bc of symbolic link is set to gcc compiler still. How can I change it for a system, and is it safe to do?

What’s your use case? Edits to makepkg.conf only apply to using makepkg.

Since I use always a clang too lchain to write my programs I just wanna that cmake will set clang as a default compiler when I use it, and I wanna that it will be set implicitly without any explicit use. Like to write a compiler name in cmake file itself or without using explicit cmake commands.

You’d have to set the two variables above when building or add them as environment variables.

1 Like

It works, thank you. How can I close this topic?

There’s no need to close it, however it’s customary to mark the post that solved your issue as the :ballot_box_with_check: Solution.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.