[CMake] Use-like inheritance

Christian Arnault arnault at lal.in2p3.fr
Thu Apr 19 10:42:32 EDT 2012


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 |
--------------------------------------------



More information about the CMake mailing list