Florent Castelli wrote: > Well, CMake scripts can be written in a somewhat declarative form now. > What prevents this now is that a lot of people use indirections > everywhere. For example: add_library(foo STATIC ${SRCS}) If it was a plain > list, any decent IDE would be able to parse this and add another file to > the list easily. If some commands allowed more expressive alternative > forms, it would definitely improve the situation: > > add_library(foo STATIC > bar1.c > bar2.c > WINDOWS > windows-specific.c > APPLE > apple-specific.m > )
It's up to users to use generator expressions instead of if(WIN32) or whatever: add_library(foo foo.cpp $<$<PLATFORM_ID:Windows>:foo_win.cpp> ) This has been possible for years and was designed with IDEs in mind: http://public.kitware.com/pipermail/cmake-developers/2014-September/023042.html > I find that most of the conditionals are just to create the list of > sources per platform and then the list of dependencies. It’s certainly > possible to use generator expressions for some cases, but they don’t have > the prettiest syntax around, and maybe also not access to all the local > variables that you need to pick the right files. You should be able to put any configure-time variable through the generator expressions $<BOOL> or $<STREQUAL> to make them genex-compatible. Thanks, Steve. -- 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