Hi Johannes, the only solution I can think of is something like:
# option(WITH_A ...) option(WITH_B ...) set(MySources always/present/files ...) if(WITH_A) list(APPEND MySources files/for/a ...) endif() if(WITH_B) list(APPEND MySources files/for/b ...) endif() add_executable(MyExec ${MySources}) # I have never used assembler files, so I can't comment there, and I don't think there's an option for better GUI grouping than string prefixes. Petr On Sun, May 27, 2012 at 12:35 PM, Johannes Bauer <dfnsonfsdu...@gmx.de> wrote: > Hi list, > > I'm a total beginner to CMake as a developer (although I've used it in > the past for other projects before). Now I'm starting by converting a > rather large Automake-Project to CMake. I'm doing it from scratch. > > In the project, executables and a shared library are created from the > same objects. Which objects are chosen, however, depends on the > configuration. For example consider the following sources: > > featurea/obj1.c > featurea/obj2.c > featurea/obj3.c > featureb/obj1.c > featureb/obj2.c > featureb/obj3.c > common.c > > let's say I want to create a executable only from common.c, but it > should also compile and link featurea/*.c if the option WITH_A is set > and should also compile and link featureb/*.c if the option WITH_B is > set. These I've specified in the CMakeLists file: > > option(WITH_A "Enable FOO support" ON) > option(WITH_B "Enable BAR component" OFF) > > However, I see no way of adding features to the "add_executable" option > after it has been specified (something like add_source or the likes). > How can this be done? > > Another problem I've run into is that the project has some assembly > files ("*.s"), which even though I specify them in the add_executables > command are just ignored (leading to unresolved symbols, of course, at > link time). Any pointers for this? > > And is it maybe possible (not dramatic if it isn't) to group options > into subgroups so they're easier to configure using cmake-gui? There is > a "Grouped" checkbox, but it only uses the string representation (i.e. > FOO_BAR is group FOO, subitem BAR) and allows only one level of nesting. > Something like configuration of the linux kernel (with multiple levels > of configuration) maybe? > > Best regards, > Joe > -- > > 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://www.cmake.org/mailman/listinfo/cmake -- 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://www.cmake.org/mailman/listinfo/cmake