[PATCH] Expose LLVM build flags in LLVMConfig.cmake

Brad King brad.king at kitware.com
Fri Jul 18 09:42:35 PDT 2014


On 07/18/2014 12:15 PM, Dan Liew wrote:
> The most important differences seem to be the use of the following flags
> -ffunction-sections
> -fno-exceptions
> -fno-rtti
> -pedantic

IMO we also do not need to tell applications about incidental flags
like "-W...".  Currently you read CMAKE_<LANG>_FLAGS:

> +set(LLVM_CFLAGS "${CMAKE_C_FLAGS}")
> +set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS}")

but there are other places that flags can appear.  Instead we should
construct an explicit list of flags that applications need to use to
achieve ABI compatibility and export only those.  That is why I
originally suggested the name LLVM_REQUIRED_<LANG>_FLAGS.

> +set(LLVM_USED_CXXFLAGS @LLVM_CXXFLAGS@)
> +set(LLVM_USED_CFLAGS @LLVM_CFLAGS@)

FYI, in LLVMConfig.cmake.in I used the naming convention of

  set(LLVM_XXX "@LLVM_CONFIG_XXX@")

for some setting XXX so that the CMakeLists.txt code could use

  set(LLVM_CONFIG_XXX ...)

to prepare the value for placement in the package config file.

-Brad




More information about the llvm-commits mailing list