Make checking for $<TARGET_OBJECTS:...> in Xcode generator expressions less strict.
Hi,
Consider have the following script:
add_library(FooObj OBJECT foo.cpp)
add_library(FooIntf INTERFACE)
target_sources(FooIntf INTERFACE $<TARGET_OBJECTS:FooObj>)
target_link_libraries(FooIntf INTERFACE FooObj)
add_library(FooShared SHARED foo.cpp)
target_link_libraries(FooShared PUBLIC FooIntf)
file(GENERATE OUTPUT "test.txt"
CONTENT "$<FILTER:$<TARGET_PROPERTY:FooShared,SOURCES>,INCLUDE,.*\\.cpp$>")
When I try to configure this for Xcode for simulator with several architectures I get:
> cmake .. -GXcode -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_SYSTEM_NAME=iOS
...
CMake Error at CMakeLists.txt:10 (target_link_libraries):
...
Error evaluating generator expression:
$<TARGET_OBJECTS:FooObj>
The evaluation of the TARGET_OBJECTS generator expression is only suitable
for consumption by CMake (limited under Xcode with multiple architectures).
It is not suitable for writing out elsewhere.
I understand the reason why this check is added, but in my particular example it doesn't make sense because it can be filtered out. The questions are:
- Is it possible to avoid this issue with some generator expression?
- If not, can this check be moved to later stage when
FILTER
is already processed elements?