Why do you want to use one library per header? I think, it would be sufficient to have one cc-file per header and one library per folder. The library would simply contain all files.
Why do you worry about large build directories?

Regards,
Andreas

Am 14.03.2015 um 13:19 schrieb Christoph Grüninger:
Dear CMakers,
I want to have all my C++ headers self-sufficient (self-contained),
i.e., a header can be included without additional includes. This is not
only handy but also part of Google's C++ styleguide [2].

It would be great to have a make target (let's call it headercheck),
that can check for this, by compiling a simple test.cc file for each
current_header.h:
   #include <config.h>
   #include "current_header.h"
   #include "current_header.h"

Additionally it would be great to have such a target for every folder
(checking all headers recursively) and every header that is explicitly
passed as an argument.

We tried this with CMake: We generate a test.cc file per header and
create a library for every cc file. The problem is, that we get hundreds
of additional targets, we generate a lot of folders and files which can
increase our build directory size by an order of magnitude and it does
not work properly on a per file or per directory basis.

What do you think, is there a good way to have such a target headercheck
with CMake? Or would it be better to include it as a CTest? Or better as
an external (bash) script as proposed in [1]?

If it can be done in a good way with CMake, would it be of interest to
include it as a feature in CMake? Or as an external project similar to
UseLATEX.cmake?

Bye
Christoph

[1]
http://stackoverflow.com/questions/1892043/self-sufficient-header-files-in-c-c
[2]
http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Self_contained_Headers


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to