Am 16.05.2017 um 15:11 schrieb Brad King: > On 05/16/2017 05:52 AM, Sebastian Holtermann wrote: >> There are two ways to achieve this >> 1) Put TARGETNAME_autogen/$<CONFIG>/moc_compilation.cpp >> into AUTOGEN_SOURCE_GROUP >> - Requires gen. exp. support in source_group >> >> 2) Manually replace $<CONFIG> for all configurations and put all >> variants into the AUTOGEN_SOURCE_GROUP >> - Does not require gen. exp. support in source_group >> - May flood the source_group with files from an other configurations? >> Are source groups even configuration aware? >> >> I'd prefer 1) but does source_group support generator expressions? > > I don't think so, but it could be taught to do so. The main challenge > is supporting per-configuration sources, and that would have to be > solved for either approach.
I thought per configuration source were supported already :/. > Source groups are used in IDE generators to organize source files. > The IDE project file formats tend to not have the Configuration > as a parameter to their source groups. Instead all sources for > all configurations get listed and then individual sources can be > marked with conditions on a per-configuration basis. > > Recently I refactored the VS generators to support per-config > source generation (via per-config exclusion rules). Currently > it is limited somewhat artificially but the main generation > infrastructure is there. > > OTOH the Xcode generator does not have a good way to do per-config > source files. It has very limited support for excluding source > files on a per-config basis but only by the *file name* ignoring > the directory. Okay, that would disallow TARGETNAME_autogen/$<CONFIG>/moc_compilation.cpp because of the non-unique file name. Would TARGETNAME_autogen/moc_compilation_$<CONFIG>.cpp work with the current state of VS and XCode? The file name is pretty much unique. Or maybe using $<CONFIG> is not the best idea at all. Much more useful in this AUTOGEN case (and maybe easier to implement?) would be a cmGeneratorTarget::AddSource method that takes a second configuration parameter. In fact that would be ideal because on the AUTOGEN generated files the properties "GENERATED" and "SKIP_AUTOGEN" must be set. This requires access to the cmSourceFile which is not available when using the $<CONFIG> generator expression in the current cmGeneratorTarget::AddSource. Also cmGeneratorTarget::AddIncludeDirectory with configuration parameter would be required to pass per configuration include directories. Having the two methods available is the best solution I can see at the moment. I can't do that though, my understanding of the CMake generators is too limited for that. - Sebastian -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers