cmake issue: generated files in subdirs

Aaron J. Seigo aseigo at kde.org
Thu Mar 23 22:21:38 GMT 2006


On Thursday 23 March 2006 14:42, Alexander Neundorf wrote:
> On Thursday 23 March 2006 22:06, you wrote:
> > On Thursday 23 March 2006 12:01, Alexander Neundorf wrote:
> > #include <dir/generatedfile.h>
>
> Ok, this is indeed a problem.
 
=/

> > but generatedfile.h is in the top level dir. it just means more porting
> > work and was a bit surprising to see generated files not ending up in the
> > buildtree where they were in the sourcetree.
>
> Well, it would be possible to generate the file in
> ${CMAKE_CURRENT_SOURCE_DIR}/subdir/generatedfile.h . Something like
>
> get_filename_component(absPathToFile file.ui ABSOLUTE)
> get_filename_component(absPath ${absPathToFile} PATH)
> file(RELATIVE_PATH relPath ${CMAKE_CURRENT_SOURCE_DIR} ${absPath} )
> set(outputFile ${CMAKE_CURRENT_BINARY_DIR}/${relPath}/file.h )

hmm... where would this go? in the projects CMakeLists.txt file or .. ?

> At least the example you give above cannot work for KDE, independently from
> the buildsystem (see explanation above).
>
> If we reintroduce convenience libs it will work, otherwise it can't.

even with -I. and requiring that files outside of '.' must refer to paths 
properly in #includes (e.g. #include "modules/mod1/module.h")? that at least 
is a more common requirement IME. or is this because cmake doesn't actually 
run gcc from the directory the file is in, but from the base directory 
handing gcc a relative path to the file to be compiled?

-- 
Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

Full time KDE developer sponsored by Trolltech (http://www.trolltech.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060323/269c6ada/attachment.sig>


More information about the kde-core-devel mailing list