[PATCH] Expose LLVM build flags in LLVMConfig.cmake

Dan Liew dan at su-root.co.uk
Mon Jul 21 06:28:24 PDT 2014


I had another quick look at this. It seems there are

- INTERFACE_COMPILE_OPTIONS
- INTERFACE_COMPILE_DEFINITIONS

properties on Targets. Am I right in understanding that if these were
set on targets and then exported that these properties would persist?

Am I also right in thinking that if someone imports that target then
something like INTERFACE_COMPILE_OPTIONS are not automatically added
and that a client of LLVM would have to do something like...

list(APPEND CMAKE_CXX_FLAGS
"$<TARGET_PROPERTY:LLVMSupport,INTERFACE_COMPILE_OPTIONS>")
add_definitions($<TARGET_PROPERTY:LLVMSupport,INTERFACE_COMPILE_DEFINITIONS>)

?

The reason I ask is that I suspect flags ABI compatibility may be
required on a target by target basis.

For example in ``tools/gold/CMakeLists.txt`` I noticed

```
  # Because off_t is used in the public API, the largefile parts are
required for
  # ABI compatibility.
  add_definitions( -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 )
```

there could be other areas where this it is necessary to do something similar.

The problem with using INTERFACE_COMPILE_OPTIONS and
INTERFACE_COMPILE_DEFINITIONS it would require (assuming that these
don't automatically modify the compiler flags when used on imported
targets) a client of CMake to know that they need to read these
properties and add them to their own compile flags which would be very
clunky if they use quite a few LLVM libraries.

I am sort of stumbling around here though because I don't know LLVM's
ABI requirements. I'll post this question to the list and see if I get
anything.

Thanks,
Dan.



More information about the llvm-commits mailing list