[PATCH] D142279: [cmake] Use LLVM_ENABLE_ASSERTIONS to enable assertions in libstdc++
Sergei Barannikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 22 05:45:25 PST 2023
barannikov88 added inline comments.
================
Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:87
+ # Enable assertions in libstdc++.
+ add_definitions(-D_GLIBCXX_ASSERTIONS)
endif()
----------------
foad wrote:
> barannikov88 wrote:
> > Kind of nitpick.
> > This would require CMake 3.12. The current requirement is higher (3.14 and is going to be 3.20).
> > It would also be nice to only add this flag when compiling against libstdc++, but I don't know how to do that.
> >
> I'm using cmake 3.23.2 and this does not work for me. It adds `-D1:_GLIBCXX_ASSERTIONS` to the compiler command line which fails with:
> ```
> In file included from <built-in>:413:
> <command line>:1:9: error: macro name must be an identifier
> #define 1:_GLIBCXX_ASSERTIONS 1
> ```
I should have checked first, sorry. The correct spelling is:
`add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:_GLIBCXX_ASSERTIONS>)`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142279/new/
https://reviews.llvm.org/D142279
More information about the llvm-commits
mailing list