[cmake-developers] Adding backtraces to every command
Ben Boeckel
ben.boeckel at kitware.com
Wed Jan 31 15:05:51 EST 2018
On Wed, Jan 31, 2018 at 18:53:39 +0000, Rich Chiodo via cmake-developers wrote:
> We're (Microsoft) investigating tighter integration with CMake -Server
> and the IDE.
>
> One of the things we need is to be able to get the location of where a
> property is set.
>
> CMake has a backtracing capability but it looks to me like properties
> don't actually keep track of their set location.
>
> I think the easiest way for me to do this would be to add a backtrace
> to every command execute (not 100% sure yet), but I wanted to query
> the alias for advice
>
> 1. Is this a good approach for getting the location of every Set,
> Link_Libraries, etc?
I don't think it'd be sufficient. What would the backtrace for the
`custom_prop` variable be in this case?
b/CMakeLists.txt:
add_library(foo ...)
set_property(TARGET foo PROPERTY custom_prop value1)
c/CMakeLists.txt (later):
set_property(TARGET foo APPEND PROPERTY custom_prop value2)
There could be multiple backtraces for each property and when it is
overwritten or deleted, should the previous backtraces be cleared out?
If appending was done manually using get_property(), list(APPEND), and
set_property() that approach would toss information out.
--Ben
More information about the cmake-developers
mailing list