CMake-generated llvm-config.

[cc-ing llvm-dev]

arrowdodger <6yearold@gmail.com> writes:

Hello. I've found that CMake-generated llvm-config contains -pedantic flag,
if LLVM_ENABLE_PEDANTIC was ON during cmake configuration.
This forces all llvm-config clients to build their sources with -pedantic,
which, i think, is kind of wrong.
For example, it's not possible to build LDC (LLVM D frontend), because it's
sources can't be compiled with -pedantic flag.

What do you think about this? Should this be fixed?

How do they build their frontend? Do they use LLVM as an external
library? In that case, LLVM_ENABLE_PEDANTIC should not affect them at
all. If their frontend is integrated on the LLVM cmake build system,
they can switch off -pedantic (on svn LLVM) putting this at the top of
their CMakeLists.txt:

llvm_replace_compiler_option(CMAKE_CXX_FLAGS, "-pedantic" "")
llvm_replace_compiler_option(CMAKE_C_FLAGS, "-pedantic" "")

arrowdodger <6yearold@gmail.com> writes:

How do they build their frontend?

They are running llvm-config. And it gives -pedantic, if it was generated by
CMake build. If i build LLVM with autoconf, then everything is fine.

Here is output of llvm-config built by CMake:

~/.local/llvm/bin/llvm-config --cflags
-I/usr/home/arr/.local/llvm/include -O3 -DNDEBUG -D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS -Wall -W -Wno-unused-parameter -Wwrite-strings
-pedantic -Wno-long-long

Note -pedantic here.

I agree that it doesn't make sense to put -pedantic on the output of
`llvm-config --cflags'

I'll remove that and -Wall too.

And here is output of llvm-config built by autoconf:

./llvm-config --cflags
-I/usr/home/arr/projects/llvm/llvm_1/include
-I/usr/home/arr/projects/llvm/llvm_1/include -D_DEBUG -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O2 -fPIC

There is no -pedantic here.

Has the autconf build an option similar to LLVM_ENABLE_PEDANTIC ? If
yes, what's its default?

arrowdodger <6yearold@gmail.com> writes:

Here is output of llvm-config built by CMake:

~/.local/llvm/bin/llvm-config --cflags
-I/usr/home/arr/.local/llvm/include -O3 -DNDEBUG -D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS -Wall -W -Wno-unused-parameter -Wwrite-strings
-pedantic -Wno-long-long

Note -pedantic here.

Committed a fix for this issue.

Thanks!