cmake and include dirs
David Faure
faure at kde.org
Wed Feb 15 23:34:18 CET 2006
When having file in subdirs, we (will soon) have to write something like:
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/misc
${CMAKE_CURRENT_SOURCE_DIR}/dom
${CMAKE_CURRENT_SOURCE_DIR}/xml
${CMAKE_CURRENT_SOURCE_DIR}/html
${CMAKE_CURRENT_SOURCE_DIR}/rendering
${CMAKE_CURRENT_SOURCE_DIR}/ecma
${CMAKE_CURRENT_SOURCE_DIR}/imload
${CMAKE_CURRENT_SOURCE_DIR}/imload/decoders
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/misc
${CMAKE_CURRENT_BINARY_DIR}/dom
${CMAKE_CURRENT_BINARY_DIR}/xml
${CMAKE_CURRENT_BINARY_DIR}/html
${CMAKE_CURRENT_BINARY_DIR}/rendering
${CMAKE_CURRENT_BINARY_DIR}/ecma
${CMAKE_CURRENT_BINARY_DIR}/imload
${CMAKE_CURRENT_BINARY_DIR}/imload/decoders
)
Could this be factorized, to have a way to specify both srcdir and builddir in one go?
Ideally I would just write
include_directories(misc dom xml html rendering ecma imload imload/decoders)
and for relative paths, cmake would interpret that as "in current source dir -and- in current
build dir".
(This was discussed already in the bksys times, and indeed this would avoid people
who use srcdir==builddir from forgetting some builddir include, which breaks the build
for srcdir!=builddir people). Coolo recently suggested another option, which is to
forbid srcdir==builddir completely, but that's a separate topic - in all cases it would
be good to have a way to avoid the massive duplication above.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the Kde-buildsystem
mailing list