summaryrefslogtreecommitdiff
path: root/Source/cmCMakePresetsGraphReadJSON.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-01-14 12:49:21 -0500
committerKyle Edwards <kyle.edwards@kitware.com>2022-01-19 11:21:35 -0500
commit0c2d234bc9be8fbdad5b14d3d5e66026a5d6e2fc (patch)
tree0973142d9cf229a49d9d624f1cf03cb673f956f3 /Source/cmCMakePresetsGraphReadJSON.cxx
parenta0e78cc30c9c3ab71ef6030cc30e4be51468ffb4 (diff)
downloadcmake-0c2d234bc9be8fbdad5b14d3d5e66026a5d6e2fc.tar.gz
CMakePresets: Allow files included from CMakePresets.json to be anywhere
There are some valid use cases for allowing these files to be outside the project directory. Relax the restriction, and include a strong warning in the documentation.
Diffstat (limited to 'Source/cmCMakePresetsGraphReadJSON.cxx')
-rw-r--r--Source/cmCMakePresetsGraphReadJSON.cxx26
1 files changed, 0 insertions, 26 deletions
diff --git a/Source/cmCMakePresetsGraphReadJSON.cxx b/Source/cmCMakePresetsGraphReadJSON.cxx
index ca3412446f..85cf5bed24 100644
--- a/Source/cmCMakePresetsGraphReadJSON.cxx
+++ b/Source/cmCMakePresetsGraphReadJSON.cxx
@@ -424,17 +424,6 @@ cmCMakePresetsGraph::ReadFileResult cmCMakePresetsGraph::ReadJSONFile(
{
ReadFileResult result;
- if (rootType == RootType::Project) {
- auto normalizedFilename = cmSystemTools::CollapseFullPath(filename);
-
- auto normalizedProjectDir =
- cmSystemTools::CollapseFullPath(this->SourceDir);
- if (!cmSystemTools::IsSubDirectory(normalizedFilename,
- normalizedProjectDir)) {
- return ReadFileResult::INCLUDE_OUTSIDE_PROJECT;
- }
- }
-
for (auto const& f : this->Files) {
if (cmSystemTools::SameFile(filename, f->Filename)) {
file = f.get();
@@ -444,21 +433,6 @@ cmCMakePresetsGraph::ReadFileResult cmCMakePresetsGraph::ReadJSONFile(
return cmCMakePresetsGraph::ReadFileResult::CYCLIC_INCLUDE;
}
- // Check files included by this file again to make sure they're in the
- // project directory.
- if (rootType == RootType::Project) {
- for (auto* f2 : file->ReachableFiles) {
- if (!cmSystemTools::SameFile(filename, f2->Filename)) {
- File* file2;
- if ((result = this->ReadJSONFile(
- f2->Filename, rootType, ReadReason::Included,
- inProgressFiles, file2)) != ReadFileResult::READ_OK) {
- return result;
- }
- }
- }
- }
-
return cmCMakePresetsGraph::ReadFileResult::READ_OK;
}
}