[CMake] Pure template libraries

Cristóvão Sousa crisjss at gmail.com
Wed Nov 12 11:18:35 EST 2008


On Wednesday 12 November 2008 16:00:32 Eric Noulard wrote:
> 2008/11/12 Cristóvão Sousa <crisjss at gmail.com>:
> >
> > This two doesn't help because I also need to know which are the hpp files
> > included by the one the executable includes. (This is true for compiled
> > libraries too, right?)
>
> Yes, when executable uses "classical" lib you have to:
>
> TARGET_LINK_LIBRARIES(YOUR_EXE_TARGET YOURLIB1 YOURLIB2) etc...
>
But if in YOURLIB1 I do 
TARGET_LINK_LIBRARIES(YOURLIB1 YOURLIB2)

then in YOUR_EXE_TARGET I only need to do
TARGET_LINK_LIBRARIES(YOUR_EXE_TARGET YOURLIB1)

So, in one hand, I don't need to know that YOURLIB1 needs YOURLIB2.
OTHO, I have to know, because of the include files... Taking headers files 
into account, the sample above will be

For YOURLIB1:
INCLUDE_DIRECTORIES( YOURLIB2_DIR )
TARGET_LINK_LIBRARIES( YOURLIB1 YOURLIB2 )

For YOUR_EXE_TARGET:
# Here I have to include YOURLIB2_DIR
INCLUDE_DIRECTORIES( YOURLIB2_DIR YOURLIB1_DIR )
TARGET_LINK_LIBRARIES( YOUR_EXE_TARGET YOURLIB1 )



What I said is correct, isn't it?






More information about the CMake mailing list