Replies: 4 comments 6 replies
-
集成包 不需要 find_package, 这个是 deprecated 接口,目前仅供内部使用。文档后期关于这块的 我会去掉。。 请用 add_requires/add_packages 集成包 |
Beta Was this translation helpful? Give feedback.
-
我也知道集成包不需要 |
Beta Was this translation helpful? Give feedback.
-
明白了,十分感谢。 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Xmake 版本
2.7.1
操作系统版本和架构
Windows10
描述问题
按手册说明,
find_package
如果能查找到包,则返回一个包含所有包信息的table,如果失败返回nil。我这里的
find_package
在包存在的情况下,不会返回任何值。但是在包存在的情况下,add_packages
可以将包正确添加并能够使用。请问是不是
find_package
接口改变了,还是add_packages
不再通过find_package
来添加包了?又看Issues说
find_package
是很老的接口了,那如何能在脚本域中获取包的信息呢?期待的结果
有个私有包,只是想打印出来看一看是不是在正确的地方。
工程配置
add_requires("spdlog")
target("pkg")
set_kind("binary")
add_packages("spdlog")
add_files("src/*.cpp")
before_build(function (target)
import("lib.detect.find_package")
local pkg = find_package("spdlog")
print(pkg or "nil")
end)
附加信息和错误日志
PS tx> xmake build --rebuild
--> nil
[ 20%]: cache compiling.release src\backward.cpp
[ 20%]: cache compiling.release src\main.cpp
[ 60%]: linking.release pkg.exe
[100%]: build ok!
PS tx> xrepo info spdlog
The package info of project:
require(spdlog):
-> description: Fast C++ logging library.
-> version: v1.10.0
-> urls:
-> https://github.com/xmake-mirror/build-artifacts/releases/download/spdlog-v1.10.0/windows-x64-vc142-6bf6da47960848619cd072b319304dad.7z
-> c4f93b6c3803fe9e26c097469560e398188b0c025bcca59a687343133068115e
-> repo: xmake-repo https://github.com/xmake-io/xmake-repo.git master
-> cachedir: C:\Users\conlay\AppData\Roaming.xmake\cache\packages\2209\s\spdlog\v1.10.0
-> installdir: C:\Users\conlay\AppData\Roaming.xmake\packages\s\spdlog\v1.10.0\6bf6da47960848619cd072b319304dad
-> searchdirs:
-> searchnames: spdlog-v1.10.0.7z, windows-x64-vc142-6bf6da47960848619cd072b319304dad.7z
-> fetchinfo: v1.10.0
-> version: v1.10.0
-> sysincludedirs: C:\Users\conlay\AppData\Roaming.xmake\packages\s\spdlog\v1.10.0\6bf6da47960848619cd072b319304dad\include
-> platforms: all
-> requires:
-> plat: windows
-> arch: x64
-> configs:
-> noexcept: false
-> header_only: true
-> pic: true
-> fmt_external: false
-> debug: false
-> vs_runtime: MT
-> shared: false
-> configs:
-> header_only: Use header only (default: true)
-> fmt_external: Use external fmt library instead of bundled (default: false)
-> noexcept: Compile with -fno-exceptions. Call abort() on any spdlog exceptions (default: false)
-> shared: Build shared library. (default: false)
-> configs (builtin):
-> debug: Enable debug symbols. (default: false)
-> pic: Enable the position independent code. (default: true)
-> lto: Enable the link-time build optimization. (type: boolean)
-> vs_runtime: Set vs compiler runtime.
-> values: {"MT","MTd","MD","MDd"}
-> toolchains: Set package toolchains only for cross-compilation.
-> cflags: Set the C compiler flags.
-> cxflags: Set the C/C++ compiler flags.
-> cxxflags: Set the C++ compiler flags.
-> asflags: Set the assembler flags.
Beta Was this translation helpful? Give feedback.
All reactions