diff options
| author | ruki <[email protected]> | 2020-11-08 09:26:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-11-08 09:26:40 +0800 |
| commit | 8b032f72b8f3972fe702b6f3f20d07d2d1696739 (patch) | |
| tree | 2403a1b907d1e8c75af614bf63ad51537c648efc | |
| parent | 52752cabc0e30823245be3eacc07d95d9161a156 (diff) | |
add license for target and find_package
| -rw-r--r-- | xmake/core/package/package.lua | 6 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/package/manager/xmake/find_package.lua | 7 |
3 files changed, 11 insertions, 3 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index c2f91536b..f95929648 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -82,6 +82,11 @@ function _instance:extraconf(name, item, key) return self._INFO:extraconf(name, item, key) end +-- get the package license +function _instance:license() + return self:get("license") +end + -- get the package description function _instance:description() return self:get("description") @@ -378,6 +383,7 @@ function _instance:manifest_save() -- make manifest local manifest = {} manifest.name = self:name() + manifest.license = self:license() manifest.description = self:description() manifest.version = self:version_str() manifest.kind = self:kind() diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 69e6e4068..4f7c58dc1 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1856,6 +1856,7 @@ function target.apis() , "target.set_strip" , "target.set_rules" , "target.set_version" + , "target.set_license" , "target.set_enabled" , "target.set_default" , "target.set_options" diff --git a/xmake/modules/package/manager/xmake/find_package.lua b/xmake/modules/package/manager/xmake/find_package.lua index 9ef351a87..4508ecde9 100644 --- a/xmake/modules/package/manager/xmake/find_package.lua +++ b/xmake/modules/package/manager/xmake/find_package.lua @@ -128,8 +128,8 @@ function _find_package_from_repo(name, opt) for _, link in ipairs(links) do local libinfo = find_library(link, linkdirs) if libinfo then - result.links = table.join(result.links or {}, libinfo.link) - result.linkdirs = table.join(result.linkdirs or {}, libinfo.linkdir) + result.links = table.join(result.links or {}, libinfo.link) + result.linkdirs = table.join(result.linkdirs or {}, libinfo.linkdir) result.libfiles = table.join(result.libfiles or {}, path.join(libinfo.linkdir, libinfo.filename)) end end @@ -158,8 +158,9 @@ function _find_package_from_repo(name, opt) end end - -- get version + -- get version and license result.version = manifest.version or path.filename(path.directory(path.directory(manifest_file))) + result.license = manifest.license return result end |
