clang, gcc, g++ ABI, and CMake

I want to start using clang and clang++ but have a few questions:

1. Has anyone a working, general solution for driving a CMake-built
project with clang or clang++ (using build directories not polluted by
gcc/g++ attempts)?

2. Are clang- and clang++-built libraries and programs
interchangeable with gcc- and g++-built libraries and programs?

3. Are clang- and clang++-built libraries and programs usable on
another Linux host (same distro, both 64-bit) without LLVM installed?

Thanks.

-Tom

I want to start using clang and clang++ but have a few questions:

1. Has anyone a working, general solution for driving a CMake-built
project with clang or clang++ (using build directories not polluted by
gcc/g++ attempts)?

2. Are clang- and clang++-built libraries and programs
interchangeable with gcc- and g++-built libraries and programs?

Yes. GCC and Clang implement the same ABI, any issues here is a bug either
in GCC or in Clang.

3. Are clang- and clang++-built libraries and programs usable on
another Linux host (same distro, both 64-bit) without LLVM installed?

Yes. Clang built binaries don't inherently rely on llvm.

Nick

I want to start using clang and clang++ but have a few questions:

...

2. Are clang- and clang++-built libraries and programs
interchangeable with gcc- and g++-built libraries and programs?

Yes. GCC and Clang implement the same ABI, any issues here is a bug either
in GCC or in Clang.

3. Are clang- and clang++-built libraries and programs usable on
another Linux host (same distro, both 64-bit) without LLVM installed?

Yes. Clang built binaries don't inherently rely on llvm.

Thanks, Nick!

Best,

-Tom

Not sure what you mean exactly... sounds like more of a CMake question, but if I understand you correctly, you just need to tell cmake which compiler to use, ex:

$ cd bin-dir
$ CC=clang CXX=clang++ ccmake /path/to/src

Cheers,

That's a start! Thanks, Sean.

Best,

-Tom