CMake variable naming the C++ standard library implementation or path

  Kiến thức lập trình

CMake as used to compile C++ code has a variable CMAKE_CXX_COMPILER_ID that generally identifies the compiler in use as GCC, Clang, MSVC, Nvidia, etc. Is there a similar variable that identifies that C++ standard library implementation that will be referenced in the build? E.g. like “libstdc++” (from GCC), “libc++” (from LLVM), “MSVC++” (Microsoft), “stlport” (various ancient C++ implementations shipped with this).

I don’t see anything listed at https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html but I don’t know if that’s actually comprehensive.

While this hypothetically could be used for various better- or ill-advised purposes of in-code variation, I actually just want to print it at configure-time in each of several projects that users need to be link-compatible, so that it’s easier to diagnose ‘missing symbol’ errors when a mixing of standard libraries is the cause.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT