[CMake] string transformation

David Cole david.cole at kitware.com
Sat Jul 3 08:16:23 EDT 2010


But since "(" and ")" are both valid characters in file and directory
names... and more common than ";" -- perhaps you should just use the ";" as
the delimiter...?

Otherwise, you can certainly iterate over the glob results with a foreach
loop and construct the string that you want.

Something like: (untested, just written in email)
set(dirs "")
foreach(d ${glob_results})
  set(dirs "${dirs}(${d})")
endforeach()
message("dirs='${dirs}'")


HTH,
David


On Sat, Jul 3, 2010 at 7:56 AM, Hicham Mouline <hicham at mouline.org> wrote:

>  Hello
>
>
>
> I file glob the list of directories and get the result as a list in
> MYPROJECT_LIST which is just a string with semicolons.
>
> I'd like to obtain a string that looks like this:
>
>
>
> (dir1)(dir2)(dir3)(dir4)...
>
>
>
> that I will then pass as a preprocessor macro to C++ code.
>
>
>
> Thanks,
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100703/bfe5ae29/attachment.htm>


More information about the CMake mailing list