Brad King <brad.king@...> writes: > > On 07/09/2013 11:30 AM, Stephen Kelly wrote: > > Brad King <brad.king <at> ...> writes: > >> On 06/07/2013 09:13 AM, Stephen Kelly wrote: > >>> SOURCES $<$<CONFIG:Debug>:other.cpp> > >> > >> That has been requested as a feature occasionally. I'm not sure > >> it is possible to implement on all the generators though. > > I just checked the VS 6, 9 and 11 IDEs and it is possible to mark > a source file as excluded from certain configurations. Those versions > represent all the VS generators. I do not see an obvious way to do it > in Xcode though :( > > > I looked into this a bit and pushed target-SOURCES-property to my clone. The > > sources would necessarily be config-specific if they are going to depend on > > the linked libraries. > > > > Can you think of any way around that? > > No. IIRC we have the same problem with inter-target dependencies and > we solved it by taking the union of dependencies from all configs. > Is that right? I don't think that solution can work for source files. > Perhaps for Xcode we can generate wrapper sources that conditionally > #include the real source based on the configuration.
While that would work for source files, it will not work for object files. add_library(obj OBJECT obj.cpp) add_library(iface INTERFACE) set_property(TARGET iface PROPERTY INTERFACE_SOURCES $<TARGET_PROPERTY:obj,SOURCES>) add_executable(user main.cpp) target_link_libraries(user iface) I'm sure that can work for makefile generators. Can it work for VS generators? Given that it will not work for Xcode, can we forego the #include workaround and simply exclude Xcode from the INTERFACE_SOURCES feature? Thanks, Steve. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
