ABI breaking check magic breaks check_include_cxx_file() in CMake


I've just discovered that with LLVM 4.0, LightSpark suddenly fails to
find all LLVM include files. I've looked into it, and it seems that
CMake is doing the very smart thing of attempting to link the test
applications using the tested includes, and this fails with:

/usr/bin/c++ CMakeFiles/cmTC_cd252.dir/CheckIncludeFile.cxx.o -o cmTC_cd252 -rdynamic
CMakeFiles/cmTC_cd252.dir/CheckIncludeFile.cxx.o:(.data+0x0): undefined reference to `llvm::DisableABIBreakingChecks'
collect2: error: ld returned 1 exit status

I've reported this upstream at [1]. However, do you have any idea how
we could work around the problem on our end before CMake is fixed
and all users upgrade it?

[1]:check_include_file_cxx() does not work with LLVM 4.0 include files (#16606) · Issues · CMake / CMake · GitLab