[cmake-developers] CMake usage requirements in KDE Frameworks

Brad King brad.king at kitware.com
Thu Mar 21 14:07:37 EDT 2013


On 03/20/2013 04:31 PM, Alexander Neundorf wrote:
>> The keywords won't interact well with PUBLIC/PRIVATE/INTERFACE keywords.
> 
> Let's assume there would be only PRIVATE, INTERFACE_BUILD and 
> INTERFACE_INSTALL.
> I'll use PRIVATE for building the target.
> I'll add INTERFACE_BUILD if I want to make using this target within the 
> project easier.
> I'll add INTERFACE_INSTALL if I want to make using this target when installed 
> easier.
> 
> Am I correct so far ?

No.  The keywords are:

* PUBLIC = use for me and my dependents
* PRIVATE = use for me but not my dependents
* INTERFACE = use for my dependents but not me

For PUBLIC and INTERFACE the "my dependents" is then split into
dependents using "me" from the build tree and dependents using
"me" from the install tree.

> So e.g. I could do 
> tid(hello
>    PRIVATE ${Foo_INCLUDE_DIRS} ${Bar_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/blub
>    INTERFACE_BUILD ${CMAKE_SOURCE_DIR}/blub ${Bar_INCLUDE_DIRS}
>    INTERFACE_INSTALL ${INCLUDE_INSTALL_DIR} ${Bar_INCLUDE_DIRS} )
> 
> In which way would this be problematic ?

list(APPEND somelist INTERFACE_INSTALL ${y} INTERFACE_BUILD ${x})
...
tid(hello INTERFACE_INSTALL ${somelist} ${INCLUDE_INSTALL_DIR})

The genex approach binds tightly so this does not happen.

The PUBLIC/PRIVATE/INTERFACE information belongs in the tid() call
so those keywords should not be in lists.  The BUILD/INSTALL
information belongs with each (path/directory) value so the genex
binds tightly to it and can be in lists.

-Brad



More information about the cmake-developers mailing list