mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
add_subdirectory: Add SYSTEM option
Fixes: #22401 Signed-off-by: Da Quexian <daquexian566@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@ bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
|
||||
std::string binArg;
|
||||
|
||||
bool excludeFromAll = false;
|
||||
bool system = false;
|
||||
|
||||
// process the rest of the arguments looking for optional args
|
||||
for (std::string const& arg : cmMakeRange(args).advance(1)) {
|
||||
@@ -33,6 +34,10 @@ bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
|
||||
excludeFromAll = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "SYSTEM") {
|
||||
system = true;
|
||||
continue;
|
||||
}
|
||||
if (binArg.empty()) {
|
||||
binArg = arg;
|
||||
} else {
|
||||
@@ -40,6 +45,11 @@ bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// "SYSTEM" directory property should also affects targets in nested
|
||||
// subdirectories.
|
||||
if (mf.GetPropertyAsBool("SYSTEM")) {
|
||||
system = true;
|
||||
}
|
||||
|
||||
// Compute the full path to the specified source directory.
|
||||
// Interpret a relative path with respect to the current source directory.
|
||||
@@ -102,7 +112,7 @@ bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
|
||||
binPath = cmSystemTools::CollapseFullPath(binPath);
|
||||
|
||||
// Add the subdirectory using the computed full paths.
|
||||
mf.AddSubDirectory(srcPath, binPath, excludeFromAll, true);
|
||||
mf.AddSubDirectory(srcPath, binPath, excludeFromAll, true, system);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user