[CMake] Use-like inheritance
norulez at me.com
norulez at me.com
Thu Apr 19 14:58:18 EDT 2012
You could create a macro for such purpose:
macro(AddAndInclude directory)
add_subdirectory(${directory})
include_directories(${directory}/include)
endmacro(AddAndInclude)
Usage:
AddAndInclude(/there/A)
Best Regards
NoRulez
Am 19.04.2012 um 16:42 schrieb Christian Arnault <arnault at lal.in2p3.fr>:
> Hi,
>
> My simple work model is as follows:
>
> 1) I have two projects A & B, located in independant locations. Both provide some libraries & executable
> 2) B makes use of libraries & headers provided in A
>
>
> I want to launch the build of A together B thus I do:
>
> #-------------------------
> project(B)
> add_subdirectory (/there/A)
> ...
> #-------------------------
>
> OK!
>
> Then I'd like to inherit some properties of A (let's say 'include directories' !) of course I could simply say:
>
> #--------------------
> project(B)
> ...
> add_subdirectory (/there/A)
> include_directories (/there/A/includes)
> add_library (MyBLib...)
> ...
> #----------------------
>
>
> OK! this works
>
> Now, suppose I want rather to 'export' the include_directories property while I am within the CMakeLists.txt of A, so that, it's enough to add_subdirectory(A). such as:
>
> #--------------------------------
> project(B)
> ...
> add_subdirectory (/there/A)
> add_library (MyBLib...)
> #--------------------------------
>
>
> So as the include_directories property is transparently acquired.
> How to do this in CMake ?
> (of course, I tried many features of CMake, but perhaps I have missed some important point....)
>
> Thanks for any hint
>
> Christian
>
>
>
>
> --
> --------------------------------------------
> | Christian Arnault |
> | LAL Bat 200 pièce 03a |
> | 91405 Orsay CEDEX |
> | phone : (33) 1 64 46 84 24 |
> | gsm : (33) 6 77 27 62 30 |
> | fax : (33) 1 69 07 94 04 |
> | e-mail : christian.arnault at lal.in2p3.fr |
> --------------------------------------------
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list