compile options and subdirectories
W. Tasin
tasin at fhm.edu
Sat Mar 23 21:48:31 GMT 2002
Jiann-Ming Su wrote:
>Ok, let's say I have the following directory structure in the kdevelop project:
>
>src/
>src/lib1dir/
>src/lib2dir/
>
>In the src/ directory, I have files that include headers from both lib1dir/
>and lib2dir/ subdirectories, so getting it to compile is pretty easy
>by passing it "-I./lib1dir -I./lib2dir".
>
Is it a static library or a libtool library (i.e. mostly shared lib)?
I assume we are talking about a static lib and you don't want to change
this, because on libtool libs maybe those header files should be
installed on ..../include-dirs and this would change the explanation a
little bit.
>However, what if files in lib1dir/
>includes headers from lib2dir/ and vice versa? Now, I have to pass
>"-I./lib1dir -I./lib2dir -I../lib1dir -I../lib2dir" for the entire program
>to compile correctly. Is there a more elegant solution?
>
>That is,
>"-I./lib*dir" is only good for the src/ directory, "-I./lib1dir" is only
>good for lib2dir/ subdirectory, and "-I./lib2dir" is only good for lib1dir/
>subdirectory, so passing the whole option string to the entire build
>process seems like a bad hack. How do I customize the "-I" option for each
>individual directory? Thanks for any help.
>
You have to patch the corrisponding Makefile.am. Search for the
INCLUDE-directive
like
INCLUDES = $(all_includes)
and change this to
----
INCLUDES = -I../lib1dir $(all_includes)
----
(in src/lib2dir/Makefile.am)
and
---
INCLUDES = -I../lib2dir $(all_includes)
---
(in src/lib1dir/Makefile.am)
If you have the INCLUDES= directive inside the kdevelop specific part of
the Makefile.am, so between
####### kdevelop will overwrite this part!!! (begin)##########
and
####### kdevelop will overwrite this part!!! (end)###########
you have to move this line outside of it. Save these Makefile.ams and run
"Build->Autoconf/automake" and "Build->Configure..."
After that your additional include-pathes are available.
N.B.: if somebody will help you developping your project with automake
1.5 you will have to update to an actual version of KDevelop (more
recent than 2.0.2).
-------
Another solution to your problem is using
#include "../lib1dir/foo1.h"
or
#include "../lib2dir/foo2.h"
inside your sources.
-------
Ciao
Walter
--
The KDevelop project: tasin at kdevelop.de [www.kdevelop.org]
--
oohhh sveglia.... il mondo e' ammalato, ma x colpa di chi.........
(Zucchero)
:-------W. Tasin, FB 04,FHM-------------------PGP-KeyID:0x7961A645----------:
<Key-Fingerprint: 1610 835F 0080 32F4 6140 6CF7 A7D0 44CD 7961A645>
-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«
More information about the KDevelop
mailing list