[PATCH] Expose LLVM build flags in LLVMConfig.cmake

Dan Liew dan at su-root.co.uk
Mon Jul 21 09:14:51 PDT 2014


On 21 July 2014 14:58, Stephen Kelly <steveire at gmail.com> wrote:
> On 07/21/2014 03:28 PM, Dan Liew wrote:
>
> 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?
>
>
> I don't know what you mean by 'persist'.

Apologies. By persist I meant that when the target is exported that
INTERFACE_COMPILE_OPTIONS and  INTERFACE_COMPILE_DEFINITIONS are kept
as properties on the target so the properties still exist when a
client imports the targets.

> 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...
>
>
> The new documentation in CMake 3.0 also apply to earlier versions, insofar
> as the properties and commands exist:
>
> http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html#build-specification-and-usage-requirements
>
> "The contents of the INTERFACE_COMPILE_OPTIONS target properties are Usage
> Requirements – they specify content which consumers must use to correctly
> compile and link with the target they appear on. For any binary target, the
> contents of each INTERFACE_ property on each target specified in a
> target_link_libraries() command is consumed"
>
> So, further user action is not necessary beyond use of
> target_link_libraries, if the targets have such properties populated.

Ok. I think the documentation for INTERFACE_COMPILE_* are a little
misleading because they say things like...

```
Consuming targets can add entries to their own COMPILE_OPTIONS property
       such as $<TARGET_PROPERTY:foo,INTERFACE_COMPILE_OPTIONS> to use
the compile options specified in the interface of foo.
```

which gives the impression that the client has to add the compile
options/definitions manually rather than it happening automatically.
Or maybe I'm just bad at reading documentation.

> Some information in
>
>  http://www.kdab.com/modern-cmake-with-qt-and-boost/

That was an interesting read. The '::' looks interesting, is the '::'
ignored in the name so ``Qt5::Widgets`` refers to the target
``Qt5Widgets``? I took a look at
``/usr/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake`` on my system and
I guess it is part of the target name. The ability to set interface
definitions flags based on the client's build type looks quite handy.
I couldn't see anything that looked like it would do that in the file
I mentioned. Am I missing something?

I'm not sure LLVM can use it though given the version of CMake that is
considered the minimum version.

Thanks,
Dan.




More information about the llvm-commits mailing list