CMake identifies afl-clang as AppleClang
I built the fuzzer tool afl (http://lcamtuf.coredump.cx/afl/) from sources and produced the binaries afl-clang and afl-clang++, which are wrappers around my build version of clang and clang++ that I supplied to afl.
When I configure a project with these wrappers, CMake identifies them as ApplClang, which is not correct.
Below are the transcripts of building afl and my sample project that uses afl.
brenton2maclap:afl-2.52b brenton$ echo $CC
/Users/brenton/llvm-development/llvm800/llvm-project/build/install/bin/clang
brenton2maclap:afl-2.52b brenton$ echo $CXX
/Users/brenton/llvm-development/llvm800/llvm-project/build/install/bin/clang++
brenton2maclap:afl-2.52b brenton$ make clean
rm -f afl-gcc afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze afl-as as afl-g++ afl-clang afl-clang++ *.o *~ a.out core core.[1-9][0-9]* *.stackdump test .test test-instr .test-instr0 .test-instr1 qemu_mode/qemu-2.10.0.tar.bz2 afl-qemu-trace
rm -rf out_dir qemu_mode/qemu-2.10.0
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C llvm_mode clean
rm -f *.o *.so *~ a.out core core.[1-9][0-9]* test-instr .test-instr0 .test-instr1
rm -f ../afl-clang-fast ../afl-llvm-pass.so ../afl-llvm-rt.o ../afl-llvm-rt-32.o ../afl-llvm-rt-64.o ../afl-clang-fast++
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C libdislocator clean
rm -f *.o *.so *~ a.out core core.[1-9][0-9]*
rm -f libdislocator.so
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C libtokencap clean
rm -f *.o *.so *~ a.out core core.[1-9][0-9]*
rm -f libtokencap.so
brenton2maclap:afl-2.52b brenton$ make
[*] Checking for the ability to compile x86 code...
[+] Everything seems to be working, ready to compile.
/Users/brenton/llvm-development/llvm800/llvm-project/build/install/bin/clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -DBIN_PATH=\"/usr/local/bin\" afl-gcc.c -o afl-gcc
set -e; for i in afl-g++ afl-clang afl-clang++; do ln -sf afl-gcc $i; done
/Users/brenton/llvm-development/llvm800/llvm-project/build/install/bin/clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -DBIN_PATH=\"/usr/local/bin\" afl-fuzz.c -o afl-fuzz
/Users/brenton/llvm-development/llvm800/llvm-project/build/install/bin/clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -DBIN_PATH=\"/usr/local/bin\" afl-showmap.c -o afl-showmap
/Users/brenton/llvm-development/llvm800/llvm-project/build/install/bin/clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -DBIN_PATH=\"/usr/local/bin\" afl-tmin.c -o afl-tmin
/Users/brenton/llvm-development/llvm800/llvm-project/build/install/bin/clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -DBIN_PATH=\"/usr/local/bin\" afl-gotcpu.c -o afl-gotcpu
/Users/brenton/llvm-development/llvm800/llvm-project/build/install/bin/clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -DBIN_PATH=\"/usr/local/bin\" afl-analyze.c -o afl-analyze
/Users/brenton/llvm-development/llvm800/llvm-project/build/install/bin/clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -DBIN_PATH=\"/usr/local/bin\" afl-as.c -o afl-as
ln -sf afl-as as
[*] Testing the CC wrapper and instrumentation output...
unset AFL_USE_ASAN AFL_USE_MSAN; AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. ./afl-clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -DBIN_PATH=\"/usr/local/bin\" test-instr.c -o test-instr
echo 0 | ./afl-showmap -m none -q -o .test-instr0 ./test-instr
echo 1 | ./afl-showmap -m none -q -o .test-instr1 ./test-instr
[+] All right, the instrumentation seems to be working!
[+] LLVM users: see llvm_mode/README.llvm for a faster alternative to afl-gcc.
[+] All done! Be sure to review README - it's pretty short and useful.
WARNING: Fuzzing on MacOS X is slow because of the unusually high overhead of
fork() on this OS. Consider using Linux or *BSD. You can also use VirtualBox
(virtualbox.org) to put AFL inside a Linux or *BSD VM.
NOTE: If you can read this, your terminal probably uses white background.
This will make the UI hard to read. See docs/status_screen.txt for advice.
brenton2maclap:afl-2.52b brenton$
And here is an example project that uses the afl binaries. Notice that they are identified as AppleClang.
brenton2maclap:build brenton$ cmake -DCMAKE_C_COMPILER=/Users/brenton/other-development/afl-2.52b/afl-clang -DCMAKE_CXX_COMPILER=/Users/brenton/other-development/afl-2.52b/afl-clang++ ..
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Users/brenton/other-development/afl-2.52b/afl-clang
-- Check for working C compiler: /Users/brenton/other-development/afl-2.52b/afl-clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Users/brenton/other-development/afl-2.52b/afl-clang++
-- Check for working CXX compiler: /Users/brenton/other-development/afl-2.52b/afl-clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/brenton/development/projects/afl-testing/build
brenton2maclap:build brenton$