[cmake-developers] Source file dependencies

2017-12-07 Thread Wouter Klouwen
Hi all,

In trying to improve our build rules, one of the problems I encountered
is that I effectively have some source files that cannot be compiled
unless certain targets are run.

I noticed that cmSourceFile has the AddDepend() method, which looks to
do the kind of thing that I want to do.
cmFlTKWrapUICommand and cmCPluginAPI are the only users of this, with
there being no way of setting this from a CMakeLists.txt.
The former seems to do exactly the kind of think that I need, which is
to set up some code generation.

It would be nice if I could add items to this list, perhaps through
setting a property on the source files themselves, e.g this rather
contrived short example:

add_custom_command(OUTPUT bar.h COMMAND touch bar.h)
add_custom_target(bar DEPENDS generate_bar bar.h)
set_source_files_properties(foo.cpp PROPERTIES DEPENDS bar)

Is this a bad idea? Would there be a better way?

Thanks,
W
This transmission contains information that may be confidential and contain 
personal views which are not necessarily those of YouView TV Ltd. YouView TV 
Ltd (Co No:7308805) is a limited liability company registered in England and 
Wales with its registered address at YouView TV Ltd, 3rd Floor, 10 Lower Thames 
Street, London, EC3R 6YT. For details see our web site at http://www.youview.com
-- 

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-developers


Re: [cmake-developers] Source file dependencies

2017-12-07 Thread Craig Scott
Have a look at the documentation for the OBJECT_DEPENDS source property
, which
explains some options that may be relevant for your question.

On Fri, Dec 8, 2017 at 5:08 AM, Wouter Klouwen 
wrote:

> Hi all,
>
> In trying to improve our build rules, one of the problems I encountered
> is that I effectively have some source files that cannot be compiled
> unless certain targets are run.
>
> I noticed that cmSourceFile has the AddDepend() method, which looks to
> do the kind of thing that I want to do.
> cmFlTKWrapUICommand and cmCPluginAPI are the only users of this, with
> there being no way of setting this from a CMakeLists.txt.
> The former seems to do exactly the kind of think that I need, which is
> to set up some code generation.
>
> It would be nice if I could add items to this list, perhaps through
> setting a property on the source files themselves, e.g this rather
> contrived short example:
>
> add_custom_command(OUTPUT bar.h COMMAND touch bar.h)
> add_custom_target(bar DEPENDS generate_bar bar.h)
> set_source_files_properties(foo.cpp PROPERTIES DEPENDS bar)
>
> Is this a bad idea? Would there be a better way?
>
> Thanks,
> W
> This transmission contains information that may be confidential and
> contain personal views which are not necessarily those of YouView TV Ltd.
> YouView TV Ltd (Co No:7308805) is a limited liability company registered in
> England and Wales with its registered address at YouView TV Ltd, 3rd Floor,
> 10 Lower Thames Street, London, EC3R 6YT. For details see our web site at
> http://www.youview.com
> --
>
> 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-developers
>



-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-- 

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-developers