[llvm] [runtimes] Append `-nostd*++` flags only if necessary (PR #151930)

Michał Górny via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 05:37:21 PDT 2025


mgorny wrote:

> There is a mechanism to add flags only for C++: `$<$<COMPILE_LANGUAGE:CXX>:-nostdlib++>`. Haven't tried whether this also works for `CMAKE_REQUIRED_FLAGS`.

Unfortunately, it doesn't seem to:

```
CMake Error:
  Running

   '/usr/bin/ninja' '-C' '/home/mgorny/llvm-project/build/runtimes/runtimes-bins/CMakeFiles/CMakeScratch/TryCompile-wJiSEf' '-t' 'recompact'

  failed with:

   ninja: error: build.ninja:50: bad $-escape (literal $ must be written as $$)

  



CMake Error at /usr/share/cmake/Modules/Internal/CheckSourceCompiles.cmake:108 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/Internal/CheckCompilerFlag.cmake:18 (cmake_check_source_compiles)
  /usr/share/cmake/Modules/CheckCXXCompilerFlag.cmake:55 (cmake_check_compiler_flag)
  CMakeLists.txt:167 (check_cxx_compiler_flag)
```

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


More information about the llvm-commits mailing list