[CMake] CMake and exported headers?
Mikael Lyngvig
mikael at lyngvig.org
Sun Jun 3 00:42:33 EDT 2012
Hi,
I've searched the docs, the FAQ, and Google, albeit somewhat quickly, and
have not found an answer to my question. My question is this:
Is it possible to have CMake copy header files from the local source
directory to the output directory and then automatically use the exported
headers with an -I option to the compiler, with the added requirement that
CMake must also add the global project name to the include path?
My source code is arranged as follows:
~/src/project/: All the source files of the project.
~/obj/project/: All the object files of the project (i.e. obj can be
erased safely at any time)
~/out/project: All the headers and libraries that are "exported"
(copied out) from the project. These are ready for distribution and/or
reuse in other projects.
~/out/project/ reflects the structure of the src tree 100 percent so that I
use this code to include:
[~/project/src/a/foo.cpp]
#include "project/a/foo.hpp"
#include "project/b/bar.hpp"
In other words, I want to have to explicitly state the full prefix of the
imported header file just like they are doing in LLVM. However, I do NOT
want to maintain my headers separately from my source files!
Dunno if I make much sense, but is it possible to have CMake use a scheme
where public header files are copied to another directory and then included
from _there_ instead of from the local directory? I use this setup because
I don't want to accidentally export a private header file and because it
provides in-source documentation of the structure of the project. Also,
this way, my libraries are ready for prime time and can be readily reused
in other projects without me having to copy around and maintain redundant
copies.
Thanks in advance for any help!
Cheers,
Mikael
-- Love Thy Frog!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120603/4a7aa904/attachment.htm>
More information about the CMake
mailing list