[CMake] A doubt about macros, relative paths and long args

Leopold Palomo Avellaneda leo at alaxarxa.net
Thu Mar 27 17:11:31 EDT 2008


Hi again,

please, how can I pass an EXACT string to a ARGS command in a custom command?

I need to pass the \ because I got a lot of problems with the line feeds.

Thanks in advance.

Leo



A Dijous 27 Març 2008, Leopold Palomo Avellaneda va escriure:
> Hi,
> I'm trying to create a macro for the xgettext program, adding a
> messages_extract target.
>
> I got a lot of problems, and I really don't know what I'm doing wrong.
>
> First of all, I would like to add \ to a variable, in the way that when I
> pass it to a COMMAND it receive a line feed. I don't know how to do it, I
> have had a lot of problems trying it. I finally have put all the parameters
> in a very long line.
>
> Second, in the macro, I pass two parameters: template and sources, Where,
> template is the name of the target (+.pot the file) and sources is a list
> of the sources to explore. I would like to pass the relative path , the
> name of the file, not the complete full path. How can I do it?
>
> The macro source....
>
>
> macro(GETTEXT_CREATE_TEMPLATE template sources )
> set (XGETTEXT_OPTIONS "--qt --keyword=tr
> 	--flag=tr:1:pass-c-format
> 	--flag=tr:1:pass-qt-format
> 	--keyword=trUtf8
> 	--flag=tr:1:pass-c-format
> 	--flag=tr:1:pass-qt-format
> 	--keyword=translate:2
> 	--flag=translate:2:pass-c-format
> 	--flag=translate:2:pass-qt-format --keyword=QT_TR_NOOP
> 	--flag=QT_TR_NOOP:1:pass-c-format --flag=QT_TR_NOOP:1:pass-qt-format
> 	--keyword=QT_TRANSLATE_NOOP:2 --flag=QT_TRANSLATE_NOOP:2:pass-c-format
> 	--flag=QT_TRANSLATE_NOOP:2:pass-qt-format --keyword=_
> 	--flag=_:1:pass-c-format --flag=_:1:pass-qt-format
> 	--keyword=N_ --flag=N_:1:pass-c-format --flag=N_:1:pass-qt-format
> --from-code=utf-8")
>
> add_custom_command(
> 		OUTPUT ${template}.pot
> 		COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
>         ARGS "--add-comments=TRANSLATORS:
> 		${XGETTEXT_OPTIONS}   --foreign-user
> 		-o ${CURRENT_SOURCE_DIR}/${template}.pot ${sources}"
>         DEPENDS ${template})
>
> add_custom_target( messages_extract DEPENDS ${template}.pot)
>
> endmacro( GETTEXT_CREATE_TEMPLATE)
>
> Regards,
>
> Leo



-- 
--
Linux User 152692
PGP: 0xF944807E
Catalonia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080327/787073cd/attachment.pgp>


More information about the CMake mailing list