Use the default C++ runtime when CLANG_FORCE_LIBSTDCXX is not set (#9215)
commit53d18f63ea0815bb7971cc5b15a06c11f7a740ca
authorYang, Bo <pop.atry@gmail.com>
Mon, 26 Sep 2022 18:59:03 +0000 (26 11:59 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 26 Sep 2022 18:59:03 +0000 (26 11:59 -0700)
treec066e998b3d5f8540fb91edde099adaa50dab7ad
parent17836ccdb7c48c4b4b59575ef7fea90058dac2e6
Use the default C++ runtime when CLANG_FORCE_LIBSTDCXX is not set (#9215)

Summary:
Previously, libc++ is used when the compiler is clang and `CLANG_FORCE_LIBSTDCXX` is not set. It's a surprising behavior because the user would expect HHVM to be linked with the compiler default C++ runtime when `CLANG_FORCE_LIBSTDCXX` is not set. Especially when the default C++ runtime is libstdc++ for Clang on Linux, the linker will report an error of `cannot find -lc++: No such file or directory` when `CLANG_FORCE_LIBSTDCXX` is not set. See https://github.com/facebook/hhvm/actions/runs/3099973322/jobs/5019734982 for the build log.

This PR instead uses the default C++ runtime when CLANG_FORCE_LIBSTDCXX is not set

Pull Request resolved: https://github.com/facebook/hhvm/pull/9215

Test Plan:
This PR should not change the behavior on gcc, because `CLANG_FORCE_LIBSTDCXX` is ignored when building with gcc.

When rebasing https://github.com/facebook/hhvm/issues/9129 onto this PR, the error of `cannot find -lc++: No such file or directory` should be gone.

Reviewed By: alexeyt

Differential Revision: D39703809

Pulled By: Atry

fbshipit-source-id: 9da42f74d86ab7c338b4eedd9c98c8b36006ab79
CMake/HPHPCompiler.cmake