[CMake] add_custom_command problem

Andrea Galeazzi galeazzi at korg.it
Mon Jan 17 05:29:30 EST 2011


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
>> file. I'm currently using the following statement:
>> add_custom_command(OUTPUT "./BuildNumber.h" COMMAND "java" ARGS "-jar"
>>                                         "${TOOLS}\\BuildNumberUpdater.jar"
>>
>>   "${PROJECT_PATH}\\Frameworks\\Win32\\BuildNumber.h"
>>                                         DEPENDS ${SOURCES}
>>                                         COMMENT "Changing the build numeber")
>> But the command is never invoked. Surely there's something wrong or
>> something that I don't understand, but what?
> 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} )
where:
set (SOURCES
        ${SOURCES_SourceXXYYFiles}
        ${SOURCES_HeaderXXYYFiles}
        ...
       ${SOURCES_Cfg}
      ....................
)


  set (SOURCES_HeaderXXYYFiles
        ./ASIC.H
        ./BaseTypes.h
        ./HAL.h
        ./IOPort.h
        ./usb2spi.h
        ./BuildNumber.h
)
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?


More information about the CMake mailing list