xmake icon indicating copy to clipboard operation
xmake copied to clipboard

更改项目目录名称后编译失败

Open xinyu-391 opened this issue 5 months ago • 5 comments

你在什么场景下需要该功能?

原本编译正常的一个项目,有使用一个开源库(fmt)源码编译,方式如下:

package("fmt")
    add_deps("cmake")
    set_sourcedir(path.join(os.scriptdir(), "deps/fmt"))
    on_install(function (package)
        local configs = {}
        table.insert(configs, "-DCMAKE_BUILD_TYPE=Release")
        import("package.tools.cmake").install(package, configs)
    end)
package_end()

后来修改整个项目目录名称后,编译失败。 分析发现,在build/.packages下,编译好的 ftm的cmake 用的绝对路径, build/.packages/f/fmt/latest/cache/build_4e0143c9/CPackConfig.cmake

set(CPACK_BUILD_SOURCE_DIRS "/home/user/proj/octopus/deps/fmt;/home/user/proj/octopus/build/.packages/f/fmt/latest/cache/build_4e0143c9")

修改项目路径后,导致找不到了。 所以,能不能用相对路径呢?

描述可能的解决方案

使用相对路径。

描述你认为的候选方案

No response

其他信息

No response

xinyu-391 avatar Sep 24 '25 01:09 xinyu-391

修改项目目录名,失败的 log 是什么呢,你给出的内容似乎没有任何关系

star-hengxing avatar Sep 24 '25 02:09 star-hengxing

Bot detected the issue body's language is not English, translate it automatically.


Title: Compilation failed after changing the project directory name

In what scenario do you need this function?

A project that was originally compiled normally was compiled using an open source library (fmt) source code, the method is as follows:

package("fmt")
    add_deps("cmake")
    set_sourcedir(path.join(os.scriptdir(), "deps/fmt"))
    on_install(function (package)
        local configs = {}
        table.insert(configs, "-DCMAKE_BUILD_TYPE=Release")
        import("package.tools.cmake").install(package, configs)
    end)
package_end()

Later, after modifying the entire project directory name, the compilation failed. Analysis shows that under build/.packages, the compiled ftm cmake uses the absolute path. build/.packages/f/fmt/latest/cache/build_4e0143c9/CPackConfig.cmake

set(CPACK_BUILD_SOURCE_DIRS "/home/user/proj/octopus/deps/fmt;/home/user/proj/octopus/build/.packages/f/fmt/latest/cache/build_4e0143c9")

After modifying the project path, it cannot be found. So, can we use relative paths?

###Describe possible solutions

Use relative paths.

Describe what you consider to be a candidate

No response

Other information

No response

Issues-translate-bot avatar Sep 24 '25 04:09 Issues-translate-bot

Bot detected the issue body's language is not English, translate it automatically.


Modify the project directory name, what is the failed log? The content you gave seems to have nothing to do with it.

Issues-translate-bot avatar Sep 24 '25 04:09 Issues-translate-bot

提供下完整工程和具体错误信息。

waruqi avatar Sep 25 '25 13:09 waruqi

Bot detected the issue body's language is not English, translate it automatically.


Provide complete project and specific error information.

Issues-translate-bot avatar Sep 25 '25 14:09 Issues-translate-bot