[CMake] Converting implicit makefile rules

Nick Davidson Nick at toby-churchill.com
Mon Jul 6 13:07:11 EDT 2009


Dear List,

Is there an idomatic way of converting an implicit makefile rule to a
CMakeLists construct?
Currently I'm resorting to writing a macro which processes list
variables with foreach and adds various linked custom targets but I'm
finding lots of confusion when passing lists as arguments to macros.

I tried the following:

macro (MakeCustomTarget TARGET_FILE CPP XML)
  add_custom_target(TARGET_FILE ALL          
    COMMAND process ${TARGET_FILE} ${CPP}
    COMMAND process ${TARGET_FILE} ${XML})
  message(STATUS "Cannot find xgettext")       
endmacro (MakeCustomTarget TARGET_FILE CPP XML) 

calling MakeCustomTarget("TargetFile" ${LIST1} ${LIST2}) where LIST1 and
LIST2 are semi-colon separated lists causes the first two elements of
whatever the LIST1 was to get passed as CPP and XML - I had to resort to
quoting the arguments and then turning them back in to lists with a set.

macro (MakeCustomTarget TARGET_FILE CPP XML)
  set(CPP_LIST ${CPP})
  set(XML_LIST ${XML})
    add_custom_target(TARGET_FILE ALL          
    COMMAND process ${TARGET_FILE} ${CPP_LIST}
    COMMAND process ${TARGET_FILE} ${XML_LIST})
endmacro (MakeCustomTarget TARGET_FILE CPP XML) 

MakePot("project.pot" "${LIST1}" "${LIST2}")

Is this behavior expected? I'm running Debian Lenny and Cmake 2.6-patch0

Thanks,

Nick Davidson


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________


More information about the CMake mailing list