Need help about forcing dependancy

Laurent Montel montel at kde.org
Tue Mar 21 15:55:21 CET 2006


Hi,
I have this code:
set(COMBINEDHEADERSICAL
   ${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalversion.h
   ${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icaltime.h
   ${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalduration.h
   ${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalperiod.h
   ${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalenums.h
   ${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icaltypes.h
   ${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalrecur.h
   ${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalattach.h
   ${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalderivedvalue.h
...
}

icalderivedvalue.h is a generated file generated by a custom command
add_custom_command(OUTPUT 
${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalderivedvalue.h COMMAND 
${PERL_EXECUTABLE} ARGS -I${ICALSCRIPTS} ${ICALSCRIPTS}/mkderivedvalues.pl -i 
${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalderivedvalue.h.in -h 
${CMAKE_SOURCE_DIR}/libkcal/libical/design-data/value-types.csv > 
${CMAKE_SOURCE_DIR}/libkcal/libical/src/libical/icalderivedvalue.h   DEPENDS  
${VALUEDEPS} )

(this macro works fine it's not a problem)

But I am a macro which will create a ical.h file

macro(CREATE_ICAL_FILE _out_FILE)
    FILE(WRITE ${_out_FILE} "#ifdef __cplusplus\n")
    FILE(APPEND ${_out_FILE} "extern \"C\" {\n")
    FILE(APPEND ${_out_FILE} "#endif\n")
    FILE(APPEND ${_out_FILE} "/*\n")
    FILE(APPEND ${_out_FILE} " $$''Id''$$\n")
    FILE(APPEND ${_out_FILE} "*/\n")

    foreach (_current_FILE ${COMBINEDHEADERSICAL})
        FILE(READ ${_current_FILE} _contents)
        STRING(REGEX REPLACE "#include.*\"ical" "" _contents "${_contents}" )
        STRING(REGEX REPLACE "#include.*\"config" "" _contents 
"${_contents}" )
        STRING(REGEX REPLACE "#include.*\"pvl.h\"" "" _contents 
"${_contents}" )
        STRING(REGEX REPLACE "\$$(Id|Locker): .+\$$" "" _contents 
"${_contents}" )
        FILE(APPEND ${_out_FILE} "${_contents}")
    endforeach (_current_FILE ${COMBINEDHEADERSICAL})

    FILE(APPEND ${_out_FILE} "\n")
    FILE(APPEND ${_out_FILE} "#ifdef __cplusplus\n")
    FILE(APPEND ${_out_FILE} "}\n")
    FILE(APPEND ${_out_FILE} "#endif\n")
endmacro(CREATE_ICAL_FILE)


But cmake doesn't like it.
Because it doesn't know file 
(icalderivedvalue.h is not generated before to go to CREATE_ICAL_FILE macro)

How force to call first custom_command which generate icalderivedvalue.h 
before to go to macro ?

For me I want :
-> generate icalderivedvalue.h
-> after go to macro

=> I don't know how to define a dependancy "first custom_command, second 
macro.

Thanks for your help.


More information about the Kde-buildsystem mailing list