summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-11-20 14:12:11 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-20 14:12:11 (GMT)
commit3c1176bb24a06644864dc0a3c0a8e757d631e350 (patch)
tree077c32d3c8f2830bd90ccf4d376c5cd5a535700f
parent13874b2631d9b5b2d7a10ac85d0c77802c10cad2 (diff)
parenta3a85524cd133888288689871e69da76f2267eda (diff)
downloadCMake-3c1176bb24a06644864dc0a3c0a8e757d631e350.zip
CMake-3c1176bb24a06644864dc0a3c0a8e757d631e350.tar.gz
CMake-3c1176bb24a06644864dc0a3c0a8e757d631e350.tar.bz2
Merge branch 'fileapi-file-sets-base-dirs-relative' into release-3.27
Merge-request: !8977
-rw-r--r--Help/manual/cmake-file-api.7.rst4
-rw-r--r--Source/cmFileAPICodemodel.cxx2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json8
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json2
4 files changed, 9 insertions, 7 deletions
diff --git a/Help/manual/cmake-file-api.7.rst b/Help/manual/cmake-file-api.7.rst
index 5f16a8b..a6d2345 100644
--- a/Help/manual/cmake-file-api.7.rst
+++ b/Help/manual/cmake-file-api.7.rst
@@ -1094,7 +1094,9 @@ with members:
``baseDirectories``
A JSON array of strings specifying the base directories containing sources
- in the file set.
+ in the file set. If the file is inside the top-level source directory
+ then the path is specified relative to that directory. Otherwise the path
+ is absolute.
This field was added in codemodel version 2.5.
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 280ebb0..53efb0d 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -1636,7 +1636,7 @@ Json::Value Target::DumpFileSet(cmFileSet const* fs,
Json::Value baseDirs = Json::arrayValue;
for (auto const& directory : directories) {
- baseDirs.append(directory);
+ baseDirs.append(RelativeIfUnder(this->TopSource, directory));
}
fileSet["baseDirectories"] = baseDirs;
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json
index f6cfa9c..8d1d219 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json
@@ -10,25 +10,25 @@
"name": "HEADERS",
"type": "HEADERS",
"visibility": "PUBLIC",
- "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset$"]
+ "baseDirectories": ["^fileset$"]
},
{
"name": "a",
"type": "HEADERS",
"visibility": "PRIVATE",
- "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset$"]
+ "baseDirectories": ["^fileset$"]
},
{
"name": "b",
"type": "HEADERS",
"visibility": "PUBLIC",
- "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset/dir$"]
+ "baseDirectories": ["^fileset/dir$"]
},
{
"name": "c",
"type": "HEADERS",
"visibility": "INTERFACE",
- "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset$"]
+ "baseDirectories": ["^fileset$"]
}
],
"sources": [
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json
index 591ba4f..e97f6d4 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json
@@ -10,7 +10,7 @@
"name": "HEADERS",
"type": "HEADERS",
"visibility": "INTERFACE",
- "baseDirectories": [".*/Tests/RunCMake/FileAPI/fileset$"]
+ "baseDirectories": ["^fileset$"]
}
],
"sources": [