[CMake] Action to perform unconditionally

Michael Hertling mhertling at online.de
Wed Feb 2 09:40:05 EST 2011


On 02/02/2011 03:11 PM, Ilja Golshtein wrote:
> 02.02.2011, 16:42, "Michael Hertling" <mhertling at online.de>:
>> On 02/02/2011 02:27 PM, Ilja Golshtein wrote:
> 
>>>  the problematic step is ADD_DEPENDENCIES.
>>>
>>>  I don't have any suitable target.
>>>
>>>  The referred CMakeLists.txt has main/main.c. Unfortunately mine does not - just add_subdirectory.
>>
>> But in the subdirectory, there's a target, isn't it? So, just use
>> ADD_DEPENDENCIES() there; with CMake, targets are global entities.
> 
> No, there is not - just another bunch of add_subdirectory ;)

But *somewhere* in your project, there is a target? 8|

> Obviously I can choose arbitrary executable and link my target to it.

Preferably, choose the targets which need the version.h header.

> I am just looking for better solution ... 
> As simple as Phony target.

Another possible approach would be a dependency of the built-in target
"all" on the custom target which generates the header, so consider to
vote for #8438 when the question for the most appreciated bug fixes /
feature requests will be asked again.

Regards,

Michael


More information about the CMake mailing list