On Jan 24, 2014, at 12:49 PM, Stephen Kelly <[email protected]> wrote:

> Roger Leigh wrote:
> 
>> 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?
> 
> Exactly.

That sounds all viable to me for having the separate mechanisms. But does CMake 
not already parse the C++ module files in order to determine the dependencies 
on header files ? I was in the believe that you do not actually need to specify 
the header files when calling add_executable because it would find out which 
are included by each specified .cpp file and add the appropriate file 
dependencies. If so, it would actually be able to determine the correct paths 
to add to the include search path. But I also see one problem left here. That 
for some projects the location of header files can differ between source/build 
tree and installation. I still would assume that in most cases the correct 
relative path can be deduced from the build configuration and dependency 
analysis of .cpp modules.

See also 
http://cmake.3232098.n2.nabble.com/Query-regarding-header-files-in-CMakeLists-txt-td7581689.html

> 
>> 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.
> 
> My thoughts exactly.
> 
> Thanks,
> 
> Steve.
> 
> 
> -- 
> 
> 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://www.cmake.org/mailman/listinfo/cmake

-- 

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://www.cmake.org/mailman/listinfo/cmake

Reply via email to