[CMake] Re: Processing new extensions with cmake

Michael Biebl mbiebl at gmail.com
Mon Apr 10 23:13:18 EDT 2006


FWIW, this is my solution so far:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
MACRO(PROCESS_IIFILES _i_FILES _ii_FILES)
        SET(_i_FILES)
        FOREACH(_current_FILE ${ARGN})
                GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
                GET_FILENAME_COMPONENT(_abs_PATH ${_tmp_FILE} PATH)
                GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)

                SET(_i_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.i)
                ADD_CUSTOM_TARGET(${_basename} ALL
                        COMMAND echo "Processing: ${_current_FILE}"
                        COMMAND
${CMAKE_BINARY_DIR}/tools/install_service -i
${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} -o ${_i_FILE}
                        DEPENDS ${_current_FILE})
                ADD_DEPENDENCIES(${_basename} install_service)
                SET(${_i_FILES} ${${_i_FILES}} ${_i_FILE})

        ENDFOREACH(_current_FILE)
ENDMACRO(PROCESS_IIFILES)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
SET(II_FILES
        test1.ii
        test2.ii
        test3.ii
)

PROCESS_IIFILES(I_FILES ${II_FILES})

INSTALL_FILES(/share/data/ FILES ${I_FILES})
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

This works, more or less. But there is still one huge downside with
this solution. The ifiles are always regenerated on calling "make" and
I only want them to be regenerated if the file itself or the
install_service binary has changed. Ideas, how I could do that?

Cheers,
Michael


More information about the CMake mailing list