Unable to pass C++ compiler check without libstdc++
Hi!
What is the best way to pass C++ compiler check if you don't have libstdc++, but you have a clang bundle with libc++ in a custom location?
I have a clean agent with unzipped llvm+clang bundle. To get it to work I have to select CXX compiler from this toolchain (yes, I can pass it as env) and add -stdlib=libc++ copmile option to my target. But CMake's compiler check doesn't take them into account and thus fails with:
Building CXX object CMakeFiles/cmTC_db6f8.dir/testCXXCompiler.cxx.o
/opt/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang++ -o CMakeFiles/cmTC_db6f8.dir/testCXXCompiler.cxx.o -c /home/user/p/test/cmake_libc++_test/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_db6f8
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_db6f8.dir/link.txt --verbose=1
/opt/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang++ -rdynamic CMakeFiles/cmTC_db6f8.dir/testCXXCompiler.cxx.o -o cmTC_db6f8
/usr/bin/ld: cannot find -lstdc++
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
What's the best practice for it? Setting up a toolchain file with CMAKE_CXX_FLAGS_INIT? Force caching CMAKE_CXX_FLAGS with proper stdlib before calling project()? Skipping the compiler checks?