[cmake-developers] target sources property
Stephen Kelly
steveire at gmail.com
Fri Jun 7 09:13:01 EDT 2013
Brad King wrote:
> On 06/07/2013 08:35 AM, Stephen Kelly wrote:
>> I looked into it a bit and found that the SOURCES target property already
>> exists. I was going to just add
>>
>>
>> + for(std::vector<std::string>::iterator i = this-
>>> ObjectLibraries.begin();
>> + i != this->ObjectLibraries.end(); ++i)
>> + {
>> + ss << sep;
>> + sep = ";";
>> + ss << "$<TARGET_OBJECTS:" + *i + ">";
>> + }
>>
>> and make set_source_files_properties ignore entries of the form
>> $<TARGET_OBJECTS:foo>, but I wonder if it would be better to create a new
>> property?
>
> I wonder if we can use the SOURCES property but lift the read-only
> restriction by special-casing the property storage similar to how
> you do for include directories. It should know the cmSourceFile*
> internally but present the value as a path to the source file
> as specified by the project in the property value. Then replace
> the ObjectLibraries member with another representation in the
> special SOURCES property storage vector.
>
Yes, that was the plan sort of.
I guess I can't teach set_source_files_properties to ignore generator
expressions entirely, because I guess you'd want to do this:
set_property(TARGET foo APPEND PROPERTY
SOURCES $<$<CONFIG:Debug>:other.cpp>)
get_target_property(srcs foo SOURCES)
set_source_files_properties(${srcs} PROPERTIES ...)
So I guess set_source_files_properties needs to learn about generator
expressions anyway, and it can skip over $<TARGET_OBJECTS> entries as it
can't do anything useful with them.
Thanks,
Steve.
More information about the cmake-developers
mailing list