Allow INTERFACE_SOURCES to specify $<TARGET_OBJECTS> (#14970)

Fix cmTarget::GetSourceFiles to set EvaluateForBuildsystem on the
$<TARGET_PROPERTY:...,INTERFACE_SOURCES> generator expression so that
the $<TARGET_OBJECTS> generator expression is allowed within an
INTERFACE_SOURCES value.

Extend the InterfaceLibrary test to cover this case.  Extend the
RunCMake.TargetObjects test to cover failure of $<TARGET_OBJECTS>
when used through $<TARGET_PROPERTY:...,INTERFACE_SOURCES> in a
non-buildsystem context.
This commit is contained in:
Brad King
2014-07-09 13:11:38 -04:00
parent 55d3e88fb7
commit affe9d56a2
8 changed files with 31 additions and 4 deletions
+5 -1
View File
@@ -18,8 +18,12 @@ set_property(TARGET imp::iface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMEPRO
set_property(TARGET imp::iface PROPERTY INTERFACE_SOMEPROP OFF)
set_property(TARGET imp::iface PROPERTY INTERFACE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist.cpp)
add_library(objlib OBJECT obj.cpp)
add_library(iface_objlib INTERFACE)
target_sources(iface_objlib INTERFACE $<TARGET_OBJECTS:objlib>)
add_executable(InterfaceLibrary definetestexe.cpp)
target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface)
target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface iface_objlib)
add_subdirectory(libsdir)
+2 -1
View File
@@ -15,9 +15,10 @@
#error Expected IFACE_HEADER_BUILDDIR
#endif
extern int obj();
extern int sub();
int main(int,char**)
{
return sub();
return obj() + sub();
}
+1
View File
@@ -0,0 +1 @@
int obj() { return 0; }