Christopher Lang wrote:
Hi,
is it possible to add a custom suffix rule to a makefile like:
.po.mo:
$(MSGFMT) -o $@ $<
Will the following do?
ADD_CUSTOM_TARGET (.po.mo
...
)
This would be nice, but the feature doesn't exist as far as I know. You
could accomplish something similar (but not as handy) with a macro:
MACRO(ADD_PO_MO_TARGET _file)
# You'll need to figure out how to make the output name. See
# documentation for STRING and GET_FILENAME_COMPONENT.
# CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR are also
# useful variables to consider
STRING(REPLACE .po .mo output_name)
# You want ADD_CUSTOM_COMMAND instead of ADD_CUSTOM_TARGET since this
# will produce an output file.
ADD_CUSTOM_COMMAND(OUTPUT ${output_name}
COMMAND ${MSGFMT} ARGS -o ${output_name} ${_file}
DEPENDS ${_file}
COMMENT "Compiling ${output_name} from ${_file}"
)
ENDMACRO(ADD_PO_MO_TARGET)
Just call the macro now for ever .po file in your system. This could be
facilitated with a for loop.
James
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake