Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql package 查找时指定moduledirs无效的问题 #2160

Closed
Meigumikato opened this issue Mar 13, 2022 · 11 comments
Closed

mysql package 查找时指定moduledirs无效的问题 #2160

Meigumikato opened this issue Mar 13, 2022 · 11 comments
Labels

Comments

@Meigumikato
Copy link

Xmake Version

v2.6.4+master.8dfd4c9

Operating System Version and Architecture

manjaro kernel version 5.15.25

Describe Bug

cmake version 3.22.2
xmake file

add_requires(
"cmake::MySQL",
{
system = true,
configs = {
envs = {
CMAKE_MODULE_PATH = {"..../cmake"}
},
moduledirs = {".../cmake"} //
}
}
)
add_requires("sqlpp11")
在使用sqlpp11 库的过程中,有mysql的依赖,在xmake require sqlpp11 后 手动添加mysql时,发现添加moduledirs路径后 会出现
cmake 错误

Expected Behavior

CMake Error at CMakeLists.txt:3 (add_cmake_modules):
Unknown CMake command "add_cmake_modules"

Project Configuration

add_requires(
"cmake::MySQL",
{
system = true,
configs = {
envs = {
CMAKE_MODULE_PATH = {"..../cmake"}
},
moduledirs = {".../cmake"} //
}
}
)
add_requires("sqlpp11")

Additional Information and Error Logs

No response

@Meigumikato
Copy link
Author

image

@Meigumikato Meigumikato changed the title mysql package 查找时是指定moduledirs无效的问题 mysql package 查找时指定moduledirs无效的问题 Mar 13, 2022
@waruqi
Copy link
Member

waruqi commented Mar 13, 2022

Unknown CMake command "add_cmake_modules"

@xq114 没这接口么?我之前是看 #1632 里面提到用的这个。。

我刚改用 CMAKE_MODULE_PATH 了,再试试 xmake update -s dev

@Meigumikato
Copy link
Author

更新脚本中的cp 命令是不是复制错了目录?
sh /usr/share/xmake/scripts/update-script.sh /usr/share/xmake /tmp/.xmake1000/220313/xmakesrc/dev/xmake`
#!/bin/sh

cd "$1"
rm -rf actions core includes languages modules platforms plugins repository rules scripts templates themes
cp -rf "$2" "$1/.."

@waruqi
Copy link
Member

waruqi commented Mar 13, 2022

@Meigumikato
Copy link
Author

image
失败了

@waruqi
Copy link
Member

waruqi commented Mar 13, 2022

你之前怎么装的?不建议走 apt 或者 make install 安装,无法支持 xmake update

建议用 官网和 readme 的一键安装脚本安装

@Meigumikato
Copy link
Author

我用aur装的,我换成脚本安装的了
add_requires(
"cmake::MySQL",
{
system = true,
configs = {
envs = {
CMAKE_MODULE_PATH = "../cmake"
}
}
}
)
这样还是无法正确找到MySQL,我使用cmake用同样的module path就可以正确找到
cmake
set(CMAKE_MODULE_PATH "../cmake")
find_package(MySQL REQUIRED)

image
image

@waruqi
Copy link
Member

waruqi commented Mar 13, 2022

更新过后,可以用 moduledirs 了,另外 不要用相对路径,xmake 内部自动创建的 tmp cmake repo 去探测,你传 ../cmake ,怎么可能知道在哪里。。用 os.scriptdir() 获取当前脚本路径,+ path.join

@Meigumikato
Copy link
Author

嗯,我用的是绝对路径,我想问下xmake有没有像cmake一样的一些通用路径变量,如cmake_source_dir

@waruqi
Copy link
Member

waruqi commented Mar 14, 2022

嗯,我用的是绝对路径,我想问下xmake有没有像cmake一样的一些通用路径变量,如cmake_source_dir

上面贴了,os.scriptdir()

用 os.scriptdir() 获取当前脚本路径,+ path.join

@Meigumikato
Copy link
Author

好的,感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants