[CMake] (no subject)

Teto mattator at gmail.com
Tue Jul 9 11:59:27 EDT 2013


Hi,

I am trying to pass several arguments of add_custom_target via a
custom proxy function that takes 1 argument only. I find it hard to
explain but this piece of code should be clearer:

=== custom function ===
function(myfunc PROGRAM command_line)
      .... // some code here
      add_custom_target(
            ${PROGRAM}
                        COMMAND ${PROGRAM_BINARY}
                         ${command_line}
                        )
endfunction()

== how I call it ==
myfunc( gengetopt "-i menudescriptor.ggo WORKING_DIRECTORY
${CMAKE_CURRENT_LIST_DIR}")

if we expand arguments I should have
      add_custom_target(
            gengetopt
                        COMMAND /usr/bin/gengetopt -i
menudescriptor.ggo WORKING_DIRECTORY /my/working/directory
                        )

Then when generating the makefile WORKING_DIRECTORY is considered as a
part of the COMMAND, and the makefile calls:
"/usr/bin/gengetop -i menudescriptor.ggo WORKING_DIRECTORY
/my/working/directory"
instead of having "/usr/bin/gengetop -i menudescriptor.ggo" run in
"/my/working/directory"

Is there any "eval" function I could use ?

Best regards

Matt


More information about the CMake mailing list