Hi, I'm new to cmake.

I asked at #cmake how to prefix a string to a list of paths.
I got the reply that I should use a foreach loop which worked.

Can I abstract this pattern using a macro such as this?


  # prefix and suffix each element of list by ${prefix}elemnt${suffix}
  macro(PREFIXSUFFIX list_name prefix suffix)
    # create empty list - necessary?
    SET(${list_name}_TMP)

    # prefix and suffix elements
    foreach(l ${list_name})
      list(APPEND ${list_name}_TMP ${prefix}${l}${suffix} )
    endforeach()

    # replace list by tmp list
    SET(${list_name} ${list_name}_TMP)
    UNSET(${list_name}_TMP)
  endmacro(PREFIXSUFFIX)


When running make I get something like:

make[2]: *** No rule to make target
`/pr/tasks/terraView_trunk/build/cmake/UI_FILES_TMP', needed by
`UI_FILES_TMP.h'.  Stop.


So what's the missing piece I don't understand yet?

Sincerely
Marc Weber
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to