Sorry for a very rookie question so please flame away.
I had a list of sources that were passed around and I wanted to use target_sources
instead so I can use more “elegant” genex processing of including various sources based on build options etc, instead of crude if
s. This works well if I only build the thing.
Now the problem I had overlooked is that this list of sources was also used as input to a custom script. I thought I could then just get the sources out of the target via a property and feed it to the script and it would look the same. Not so easy alas.
Eg one parameter to this script is a semicolon separated list of files which was previously created with separate_arguments(res UNIX_COMMAND "${some_sources};${other_sources}")
. The output of this is a list of files with the semicolon escaped, i.e. file1\;file2
.
Replacing this with separate_arguments(res UNIX_COMMAND "$<TARGET_PROPERTY:my_tgt,INTERFACE_SOURCES>;${other_sources}")
gives the sources from the target as just semicolon separated (not escaped that is) and the sources from ${other_sources}
(a conventional list) as a “escaped semicolon” separated string.
Is there some good way of forcing the genex to be evaluated before I call the script so I can post-process it into the required shape? Or is it perhaps better to use some other method than this unorthodox usage of separate_arguments
to create an “escaped semicolon” separated string?
Or perhaps I should just keep the list of sources and avoid the genexing.