On 26 Jan., 21:34, Kornel Benko <[email protected]> wrote:
> You have to define a dependency
>
> e.g.
> add_custom_command(
> ...
> DEPENDS zz.i ....
> )
So I tried this:
IF(MSVC)
SET(PREPROCESSOR_FLAGS "/EP")
ELSE()
SET(PREPROCESSOR_FLAGS "-E")
ENDIF()
SET(C_PREPROCESS ${CMAKE_CXX_COMPILER} ${PREPROCESSOR_FLAGS})
macro(preprocess in out)
add_custom_command(OUTPUT ${out}
COMMAND ${C_PREPROCESS} ${in} -o ${out}
DEPENDS ${in}
)
endmacro(preprocess)
preprocess(${CMAKE_CURRENT_SOURCE_DIR}/Panorama_accessors.h
Panorama_accessors.i)
preprocess(${CMAKE_CURRENT_SOURCE_DIR}/SrcPanoImage_accessors.h
SrcPanoImage_accessors.i)
ADD_CUSTOM_TARGET(hsi_accessors
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/Panorama_accessors.i"
"${CMAKE_CURRENT_BINARY_DIR}/SrcPanoImage_accessors.i"
)
now I can make hsi_accessors. It works, but it seems like a rather
circuitious route to do something very basic. Now the next step I have
to do is get the dependency chain to work. I have the following
dependencies:
XXX_accessors.h depends on <panodata/image_variables.h>
XXX_accessors.i depends on XXX_accessors.h
hsi.i depends on XXX_accessors.i
additionally, hsi.i also depends on all the header files it %includes
to generat the wrapper code from. So I'd like to express that hsi.i
needs to be processed by SWIG whenever any of the files it depends on
changes. But hsi.i isn't made from the files it includes, it only has
to be considered out of date when it's older than any of the files it
includes. I don't know how to express that in cmake.
The 'lazy metaprogramming' is sure turning out expensive when my time
is concerned... :(
> > .i .c
> You mean ".c.i" here, don't you?
I do. and having studied gnu make documentation I realize that it's
old-fashioned to use rules like this. I was confused because usually
the semantics in makefiles are target before source, like in %.i : %.c
So cmake has this rule built-in, but I can't figure out how to get it
to use it.
Kay
--
You received this message because you are subscribed to the Google Groups
"Hugin and other free panoramic software" group.
A list of frequently asked questions is available at:
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/hugin-ptx