On Wed, Feb 14, 2018 at 19:19:39 +0100, Paweł Rutka wrote: > I would like to ask about some important feature: > Is there any possibility to provide form Cmake Server side location of > command that generate the target? The Use Case is as follow: > In IDE you want to, after Class creation, automatically add CPP file into > proper add_executable or extend some variable passed to add_executable or > any other case that lead to target creation.
Note that this is a very hard problem. Take the following examples: ======= add_executable(myexe a.c b.c) ======= ======= set(sources a.c b.c) add_executable(myexe ${sources}) ======= ======= set(sources a.c b.c) add_subdirectory(foo) # does a `set(sources PARENT_SCOPE)` add_executable(myexe ${sources}) ======= ======= set(sources a.c b.c) if (some_option) list(APPEND sources c.c) endif () add_executable(myexe ${sources}) ======= ======= set(sources a.c b.c) add_executable(myexe ${sources}) set_property(TARGET myexe APPEND SOURCES d.c) ======= What would the IDE be expected to do for each of these cases? Personally, I think it would be best to just get where the target is declared. This should have a backtrace available so that this pattern is supported: ======= function (wrap_add_library) add_library(${ARGN}) # Project-specific bits. endfunction () # Somewhere else... wrap_add_library(mylib STATIC ...) ======= Once the main location is found, I think just having the "your cursor is on FOO, I'll highlight other instances of FOO" feature should be enough to get one to the right place. --Ben -- 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: https://cmake.org/mailman/listinfo/cmake-developers