Re: [cmake-developers] Cmake-server question
Sure but how would CMake solve it? It would have to keep a backtrace of all properties when a target is created. Or at least all properties involved in the list of sources. You need a backtrace (or some other way to store a source location) in order to find a source location. That seems kinda obvious. Okay maybe not a backtrace then, but just the top of the trace. -Original Message- From: cmake-developers On Behalf Of Tobias Hunger Sent: Thursday, February 15, 2018 7:38 AM To: Ben Boeckel Cc: CMake Developers Subject: Re: [cmake-developers] Cmake-server question On Thu, Feb 15, 2018 at 3:18 PM, Ben Boeckel wrote: > 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: I am very aware that adding files to cmake targets is a hard problem:-/ That's why Creator does not even try to do it. It is bound to do it wrong and thus users can not trust the functionality. If there is any chance to solve this problem, then inside cmake. At least you and your code do fully understand the cmake language. Best Regards, Tobias -- 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 -- 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
Re: [cmake-developers] Cmake-server question
On Thu, Feb 15, 2018 at 3:18 PM, Ben Boeckel wrote: > 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: I am very aware that adding files to cmake targets is a hard problem:-/ That's why Creator does not even try to do it. It is bound to do it wrong and thus users can not trust the functionality. If there is any chance to solve this problem, then inside cmake. At least you and your code do fully understand the cmake language. Best Regards, Tobias -- 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
Re: [cmake-developers] Cmake-server question
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
Re: [cmake-developers] Cmake-server question
We get some talk and backtraces will not probably either way can handle multiple scenerios with functions and macros... But currenly I think Cmake do not have any knowledge how to match for example Variables used in initial call and one passed at the bottom to add_executable (seems like all this data is lost while processing file, backtrace is recored but it do not record params so you cannot backmatch anything usefull). But this topic should probably be ask to someone in Cmake dev team how It could be resolved. Regards, Pawel 2018-02-15 10:28 GMT+01:00 Tobias Hunger : > On Wed, Feb 14, 2018 at 7:27 PM, Rich Chiodo via cmake-developers > wrote: > > This would require backtraces, I believe, on every property so you can > trace > > all the properties back to where they’re defined. I need this too for > Visual > > Studio to support adding files as well. > > I disagree: Using backtraces for this is a pretty ugly hack! > > IDEs should not need to examine backtraces for a simple and common > task like adding files to a target! Ideally server-mode would have a > way to ask cmake where to add a source into a target and that will > then tell you the file/line/column to add the file into. > > Best Regards, > Tobias > -- 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
Re: [cmake-developers] Cmake-server question
On Wed, Feb 14, 2018 at 7:27 PM, Rich Chiodo via cmake-developers wrote: > This would require backtraces, I believe, on every property so you can trace > all the properties back to where they’re defined. I need this too for Visual > Studio to support adding files as well. I disagree: Using backtraces for this is a pretty ugly hack! IDEs should not need to examine backtraces for a simple and common task like adding files to a target! Ideally server-mode would have a way to ask cmake where to add a source into a target and that will then tell you the file/line/column to add the file into. Best Regards, Tobias -- 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
Re: [cmake-developers] Cmake-server question
This would require backtraces, I believe, on every property so you can trace all the properties back to where they’re defined. I need this too for Visual Studio to support adding files as well. The problem right now is that backtraces are memory intensive. See this issue for a discussion about it: https://gitlab.kitware.com/cmake/cmake/issues/17539 From: cmake-developers On Behalf Of Pawel Rutka Sent: Wednesday, February 14, 2018 10:20 AM To: cmake-developers@cmake.org Subject: [cmake-developers] Cmake-server question 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. This mean that IDE would have to know place in CmakeLists.txt which command should extend with new path. Regards, Pawel -- 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
[cmake-developers] Cmake-server question
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. This mean that IDE would have to know place in CmakeLists.txt which command should extend with new path. Regards, Pawel -- 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