mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
project: Add SPDX_LICENSE argument
Add an argument to the `project` command to allow specifying a license for a project as a whole. This is in addition to specifying licenses on individual targets, and will be used to set the license(s) on exported packages. Also, move listing of `COMPAT_VERSION` variables to follow lexicographical order.
This commit is contained in:
@@ -38,6 +38,7 @@ struct ProjectArguments : ArgumentParser::ParseResult
|
||||
cm::optional<std::string> ProjectName;
|
||||
cm::optional<std::string> Version;
|
||||
cm::optional<std::string> CompatVersion;
|
||||
cm::optional<std::string> License;
|
||||
cm::optional<std::string> Description;
|
||||
cm::optional<std::string> HomepageURL;
|
||||
cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> Languages;
|
||||
@@ -73,11 +74,12 @@ bool cmProjectCommand(std::vector<std::string> const& args,
|
||||
.Bind("LANGUAGES"_s, prArgs.Languages);
|
||||
|
||||
cmMakefile& mf = status.GetMakefile();
|
||||
bool enableCompatVersion = cmExperimental::HasSupportEnabled(
|
||||
bool enablePackageInfo = cmExperimental::HasSupportEnabled(
|
||||
mf, cmExperimental::Feature::ExportPackageInfo);
|
||||
|
||||
if (enableCompatVersion) {
|
||||
if (enablePackageInfo) {
|
||||
parser.Bind("COMPAT_VERSION"_s, prArgs.CompatVersion);
|
||||
parser.Bind("SPDX_LICENSE"_s, prArgs.License);
|
||||
}
|
||||
|
||||
parser.Parse(args, &unparsedArgs, 0);
|
||||
@@ -263,6 +265,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
|
||||
createVariables("VERSION_PATCH"_s, version_components[2]);
|
||||
createVariables("VERSION_TWEAK"_s, version_components[3]);
|
||||
createVariables("COMPAT_VERSION"_s, prArgs.CompatVersion.value_or(""));
|
||||
createVariables("SPDX_LICENSE"_s, prArgs.License.value_or(""));
|
||||
createVariables("DESCRIPTION"_s, prArgs.Description.value_or(""));
|
||||
createVariables("HOMEPAGE_URL"_s, prArgs.HomepageURL.value_or(""));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user