[llvm] [LLVM][Cygwin] Define _GNU_SOURCE on Cygwin as well. (PR #138329)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Mon May 5 03:29:09 PDT 2025
mstorsjo wrote:
> > > cygwin's packaging builds clang standalone, and in that configuration it seems that `_GNU_SOURCE` is not defined despite this change. Any thoughts?
> >
> >
> > Hmm. I don't really have any experience with building clang standalone in that way; does the clang source tree have any form of local corresponding code that sets `_GNU_SOURCE` for glibc there?
>
> just
>
> https://github.com/llvm/llvm-project/blob/944e60f08e3571db12f8ee15e7793e6a6e157c3b/clang/CMakeLists.txt#L183-L198
Ok, I see. I guess if it strictly is necessary, then the `if(CLANG_BUILT_STANDALONE)` block at the top, which contains things like `set(CMAKE_CXX_STANDARD 17 ...` and other things matching what the toplevel LLVM CMakeLists.txt does, could take such things. But I would somehow expect that `find_package(LLVM ...` would pull in the `LLVMConfig.cmake` which you found out contained `set(LLVM_DEFINITIONS "-D_GNU_SOURCE ...`, so I guess that's the primary question now, why that's not happening.
(In case you're building in an existing build tree, things like this might not be picked up due to CMakeCache.txt.)
https://github.com/llvm/llvm-project/pull/138329
More information about the llvm-commits
mailing list