[CMake] control dependencies in cmake stage

Łukasz Tasz lukasz at tasz.eu
Thu Mar 12 04:00:09 EDT 2015


Hi,
Take a look also at Michael suggestion,
http://www.cmake.org/pipermail/cmake/2011-November/047333.html

br
L.

Łukasz Tasz


2015-03-11 0:15 GMT+01:00 Mark Abraham <mark.j.abraham at gmail.com>:
> Hi,
>
> Sure, this is straightforward to do all at make time, if you're prepared to
> find out what the names of the generated files are. They must follow some
> pattern ;-). Solutions with make-time globbing are surely impossible, and
> Petr's IF idea seems brittle to me.
>
> See (for example)
> https://github.com/gromacs/gromacs/blob/master/src/gromacs/CMakeLists.txt#L154.
> The idea is that you have some target that does the generation, and you make
> the eventual library/executable depend on its output files. The target that
> contains the generation command has its own dependencies, so you don't have
> to re-generate if those don't go out of date. In that example,
> gmx_configure_version_file just wraps configure_file(), which sets up that
> dependency chain. You'd need an add_custom_command(), it seems, whose OUTPUT
> had the list of generated files. There's no problem to use add_library()
> with a file generated in the build tree - just mention it in an output.
>
> There are several much more complicated examples at
> https://github.com/gromacs/gromacs/blob/master/docs/CMakeLists.txt. For
> example, we build a gmx binary that writes the same text we display with
> "gmx topic -h" instead as topic.rst restructedText, which is then parsed
> with Sphinx to produce manpages that go in the tarball via CPack, or to
> produce HTML to go on our webpage. Helper scripts mostly live in
> https://github.com/gromacs/gromacs/tree/master/cmake
>
> Cheers,
>
> Mark
>
>
> On Tue, Mar 10, 2015 at 6:06 PM, Tomasz Majchrowski <usenet at majchrowski.de>
> wrote:
>>
>> (sorry if you received this message twice)
>>
>> Hi Mark
>>
>> This is the  set of C++ source code files. This set will be compiled
>> during the make stage. Ideally will be to move generation to make stage.
>> Unfortunately I don't  know the name of the files that will be generated
>> before generation phase occurs.
>>
>> Therefore I can't use set_source_files_properties( foo.cxx PROPERTIES
>> GENERATED true) in cmake stage. Please drop a line if you know how to bypass
>> this limitation.
>>
>> Thanks, Tomasz.
>>
>> 2015-03-10 7:05 GMT+01:00 Mark Abraham <mark.j.abraham at gmail.com>:
>>>
>>> Hi,
>>>
>>> What are you generating that must be done at cmake time?
>>>
>>> Mark
>>>
>>> On 09/03/2015 5:36 pm, "Tomasz Majchrowski" <usenet at majchrowski.de>
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm wondering if there is an easy way to control the dependencies in the
>>>> cmake stage. Basically I would like skip execution of some script run over
>>>> execute_process in case some input files didn't change.
>>>>
>>>> The regular way will be to use add_custom_command & add_custom_target
>>>> however those required targets, so the make stage.
>>>>
>>>> Please advice how to proceed in case there is need to control this
>>>> already in cmake stage?
>>>>
>>>> Thanks, Tomasz.
>>>>
>>>>
>>>> --
>>>> Pozdrawiam/Best regards/Mit freundlichen Grüßen, Tomasz Majchrowski,
>>>> Information Technology and Services Consultant and Contractor
>>>>
>>>> --
>>>>
>>>> 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
>>>>
>>>> --
>>>> Pozdrawiam/Best regards/Mit freundlichen Grüßen, Tomasz Majchrowski,
>>>> Information Technology and Services Consultant and Contractor
>
>
>
> --
>
> 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


More information about the CMake mailing list