Skip to content

Extending CMake-server protocol to report target locations

Ivan Shcherbakov requested to merge ivan/cmake:target_location_reporting into master

This commit introduces a change to the CMake-server protocol so that it will now report the locations in CMakeLists.txt for all targets and target-related statements. This allows IDEs like VisualGDB to locate the statements and automatically edit them when the user adds or removes files or changes target properties via GUI.

An example of the new target output is shown below:

   "targets": [
	  {
		 "crossReferences": {
			"backtrace": [
			   {
				  "lineNumber": 7,
				  "name": "add_executable",
				  "path": "C:/full/path/CMakeLists.txt"
			   },
			   {
				  "lineNumber": 0,
				  "name": "",
				  "path": "c:/full/path/CMakeLists.txt"
			   }
			],
			"relatedStatements": [
			   {
				  "backtrace": [
					 {
						"lineNumber": 8,
						"name": "target_link_libraries",
						"path": "c:/full/path/CMakeLists.txt"
					 },
					 {
						"lineNumber": 0,
						"name": "",
						"path": "c:/full/path/CMakeLists.txt"
					 }
				  ],
				  "statementType": "target_link_libraries"
			   }
			]
		 },
		 <...>
		 "type": "EXECUTABLE"
	  }
   ]

Topic-rename: server-target-backtraces

Edited by Brad King

Merge request reports