[CMake] addprefix macro?
Marc Weber
marco-oweber at gmx.de
Wed May 5 10:14:31 EDT 2010
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
More information about the CMake
mailing list