On 09/08/11 00:00, Raymond Wan wrote:
> Hi Glenn,
>
>
> On Wed, Sep 7, 2011 at 20:36, Glenn Coombs <glenn.coo...@gmail.com> wrote:
>> Could you not create a file in each subdirectory called something like
>> header-deps.cmake ?  This file would contain the include_directory()
>> commands necessary for using this module, plus include() commands of other
>> modules that it depends on.  So for your example:
>>
>> # utils/b/header-deps.cmake
>> include_directories(...)
>> include(${CMAKE_SOURCE_DIR)/utils/a/header-deps.cmake)
>>
>> # utils/a/header-deps.cmake
>> include_directories(${CMAKE_SOURCE_DIR}/common/foo)
>>
>> Then you can just do include(${CMAKE_SOURCE_DIR}/utils/b/header-deps.cmake)
>> and it will add everything that B needs including all its dependencies.
>
> My understanding of Victor's question is that he would like (and I
> agree, it would be nice) for these dependencies to be determined by
> CMake auto-magically.  So, whether we add include_directories () to
> the CMake file or have a header-deps.cmake file is perhaps not as
> important (though, your suggestion would reduce the amount of clutter
> in the CMakeLists.txt file).
>
> Perhaps a script is more suitable for this task?  That is, it would
> walk through the directories and update each directories'
> header-deps.cmake.  Surely, if a script is used, it would be less
> error-prone to have the script update an external file than the
> CMakeLists.txt file itself.
>
> Fortunately for me, the depth of my directories is not as deep as
> Victor's, so I'm not quite there yet.  But perhaps later...
>
Everyone,


I've been reading through the thoughtful and helpful responses. It seems the 
simplest albeit brute-force 'work-around' is to write
and include some "use files".


For long term (according to the FAQ) a feature request should be files in the 
bug tracker. Can we we work together to create a
consensus description of the feature?
Here is something for starters:

Summary: automatically inherit include dependencies

Description:
Header-only targets may have dependencies which may themselves be header files. 
It would be extremely useful that:
    1)  header-only targets be officially recognized (instead of requiring a 
custom target
    2) dependencies for headers be picked up automatically by the build system 
such that all the dependent -I<includes> become part
of the build


-Vic



_______________________________________________
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to