[PATCH] Expose LLVM build flags in LLVMConfig.cmake

Dan Liew dan at su-root.co.uk
Fri Jul 18 09:15:32 PDT 2014


Hi,

Attached in a patch that adds the LLVM_USED_CXXFLAGS and
LLVM_USED_CFLAGS variables to LLVMConfig.cmake so that clients who try
to import LLVM targets in CMake know what build flags were used
(similar to ``$ llvm-config --cxxflags``).

This is based off a discussion in [1].

This patch isn't entirely satisfactory because the LLVMConfig.cmake file
produced by CMake and the autoconf/Makefile systems are not consistent

Autoconf/Makefile
=================
set(LLVM_USED_CXXFLAGS -g -std=c++11 -fvisibility-inlines-hidden
-fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual
-ffunction-sections -fdata-sections -Wcast-qual )
set(LLVM_USED_CFLAGS -g -fPIC )

CMake
=====
set(LLVM_USED_CXXFLAGS  -fPIC -fvisibility-inlines-hidden -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers
-pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor
-std=c++11 -fdata-sections)
set(LLVM_USED_CFLAGS  -fPIC -Wall -W -Wno-unused-parameter
-Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -fdata-sections)

The most important differences seem to be the use of the following flags
-ffunction-sections
-fno-exceptions
-fno-rtti
-pedantic

These inconsistencies should probably be fixed. But I'm not entirely
sure how. The CMake system seems to be adding -fno-rtti to individual
targets. I'm not sure about the other flags.

It would definitely simplify things greatly if we only had one build system...


[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-July/074829.html
-- 
Dan Liew
PhD Student - Imperial College London
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-LLVM_USED_CXXFLAGS-and-LLVM_USED_CFLAGS-variable.patch
Type: text/x-patch
Size: 3445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140718/1000cc27/attachment.bin>


More information about the llvm-commits mailing list