[CMake] Announcing CMake BASIS, a set of CMake based project interoperability and automation tools

Roger Leigh rleigh at codelibre.net
Fri Jan 24 07:34:23 EST 2014


On Thu, Jan 23, 2014 at 10:40:54AM +0100, Stephen Kelly wrote:
> Andreas Schuh wrote:
> 
> > On a side note, just today a co-worker asked me why the compiler cannot
> > find the header files when they were provided as additional arguments to
> > the add_executable command. Indeed this was a reasonable assumption, I
> > think. Why the need for an additional include_directories when I already
> > specified where the header files are located ? This is not something BASIS
> > is taking care of yet either, but would certainly be one of the things I
> > would consider adding.
> 
> This is the kind of concrete feedback *about cmake* that I'm looking for in 
> this discussion. It's self contained, refers to existing cmake 
> functionality, it's easy to imagine the 'user story' and what the user code 
> would look like etc.
> 
> I don't have any comment about the viability of adding such functionality to 
> cmake add_* commands though.

I'm not sure this can ever be viable because it makes assumptions that are
guaranteed to break for different use cases.

If I add a header, cmake can have no knowledge of how the sources use the
header.  Is it an absolute or relative include?  Does the relative include
also include a path?

In my projects, I have both static and generated headers.  All the sources
use absolute includes i.e <foo/bar/baz.h> and the CMakeLists.txt are located
at multiple levels inside the structure.  Other projects have the sources
and headers located separately and may not have any code generation (the
generated sources here are passed as absolute paths to add_executable).
Some projects have a mixture of public and private headers which use
absolute and relative paths.

I think the general sentiment that having add_executable remove a redundant
include_directories statement is a good one.  I'm just unconvinced that this
is doable in practice.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800


More information about the CMake mailing list