[llvm] Remember LLVM_ENABLE_LIBCXX setting in installed configuration (PR #139712)

David Truby via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 08:52:36 PDT 2025


================
@@ -19,7 +20,11 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED)
     if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
       check_cxx_compiler_flag("-stdlib=libc++" CXX_COMPILER_SUPPORTS_STDLIB)
       check_linker_flag(CXX "-stdlib=libc++" CXX_LINKER_SUPPORTS_STDLIB)
-      if(CXX_COMPILER_SUPPORTS_STDLIB AND CXX_LINKER_SUPPORTS_STDLIB)
+      cmake_push_check_state()
+      set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -stdlib=libc++")
----------------
DavidTruby wrote:

When this is processed in the runtimes cmake sub-command, `CMAKE_REQUIRED_FLAGS` contains `-nostdinc++`. You could fix this with:
```
string(REPLACE "-nostdinc++" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
```
Which makes the PR work for me. 

https://github.com/llvm/llvm-project/pull/139712


More information about the llvm-commits mailing list