[CMake] add_custom_command problem

Andrea Galeazzi galeazzi at korg.it
Mon Jan 17 06:45:33 EST 2011


Il 17/01/2011 12.34, Eric Noulard ha scritto:
> 2011/1/17 Andrea Galeazzi<galeazzi at korg.it>:
>> Il 17/01/2011 11.09, Eric Noulard ha scritto:
>>> 2011/1/17 Andrea Galeazzi<galeazzi at korg.it>:
>>>> I'm trying to invoke a program which increment the build number on a
>>>> header
> I just realized something.
> Do you want
>     A) to increase the build number EACH time you build
>     B) to increase the build number WHEN of of the SOURCES change?
>
>>> Does any targets depends on the output "BuildNumber.h" ?
>>> Did you try to specify OUTPUT with absolute path ?
>> Yes I also tried with absolute path but it doesn't change anything. That's
>> the only target I have:
>>
>> add_executable(Z102A ${SOURCES} )
> [...]
>
>>   set (SOURCES_HeaderXXYYFiles
>>        ./ASIC.H
>>        ./BaseTypes.h
>>        ./HAL.h
>>        ./IOPort.h
>>        ./usb2spi.h
>>        ./BuildNumber.h
> You need absolute path in both places
>   1) in set (SOURCES_HeaderXXYYFiles
>   2) in the add_custom_command output
>
>> set (SOURCES_Cfg
>>        ../../Cfg/AisTestData.cpp
>>        ../../Cfg/AisWin32Data.cpp
>>        ../../Cfg/AlphaKeybConfig.cpp
>>        ../../Cfg/AlphaKeybConfig.h
>>        ../../Cfg/BuildConfig.h
>>        ../../Cfg/Config.cpp
>>        ..........
>>   )
>> and Config.cpp includes BuildNumber.h. Maybe should I add an explicit
>> dependency in some ways?
> I don't think this is necessary. But could you tell us in which case you want
> your BuildNumber.h to be regenerated?
>
>
>

The B is definitely my choice.


More information about the CMake mailing list