mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-02 04:09:33 -05:00
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:
@@ -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)
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
int obj() { return 0; }
|
||||
Reference in New Issue
Block a user