[CMake] string regexp replace removes the semicolons

Vania Joloboff vania.joloboff at inria.fr
Fri Jan 22 06:29:01 EST 2016


Hi

I want to remove from a list of sources those that start with 'foo'
So I have

file(GLOB ALL_SOURCES "*.cc")
# this gives ALL_SOURCES = "a.cc;b.cc;foo_u.cc;foo_v.cc;c.cc;y.cc"
# separated by semicolons

string(REGEX REPLACE "foo.*cc" " " COMPILE_ONLY ${ALL_SOURCES})

But in the COMPILE_ONLY variable the semicolons are removed !
and then
add_library(lib ${COMPILE_ONLY}) fails

why is it removing the semicolons ?
Vania



More information about the CMake mailing list