[CMake] is it possible to include_directories in same build not by relative path?

Michael Wild themiwi at gmail.com
Thu Oct 14 06:48:37 EDT 2010


On 14. Oct, 2010, at 11:42 , Thomas Fannes wrote:

> Hello,
> 
> My project has the following structure:
> 
> root
>  + lib
>     + libA
>     + libB
>  + test
>     + test1
> 
> test1 depends on libA and libB.
> 
> For the include path in test1 I now have to write something like:
> include_directories(../../lib/libA ../../lib/libB)
> isn't there an easier way as with linking the libraries?
> target_link_libraries(test1 libA libB)
> 
> Kind regards,
> 
> Thomas

Not simpler, but more robust against renaming/moving:

include_directories(
  ${CMAKE_SOURCE_DIR}/lib/libA
  ${CMAKE_SOURCE_DIR}/lib/libB
  )


Michael

--
There is always a well-known solution to every human problem -- neat, plausible, and wrong.
H. L. Mencken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101014/373bbcb8/attachment.pgp>


More information about the CMake mailing list