xmake icon indicating copy to clipboard operation
xmake copied to clipboard

vcpkg::boost 生成 cmakefiles 后链接异常

Open jadedrip opened this issue 2 years ago • 1 comments

Xmake 版本

2.7.9

操作系统版本和架构

Windows

描述问题

我使用 xmake 导入 boost 的模块,比如 add_requires("vcpkg::boost-locale", {alias = "boost-locale"})

然后通过 Xmake 生成 cmakefiles 以便在 visual studio 里编译 结果 debug 模式链接异常,排查发现 cmakefiles 里目录设置有问题 target_link_directories(geo PRIVATE E:/vcpkg/installed/x64-windows-static/lib <= debug 时应该是 E:/vcpkg/installed/x64-windows-static/debug/lib )

并且 target_link_libraries(xxxPRIVATE boost_locale-vc140-mt <= debug 模式应该是 boost_locale-vc140-mt-gd )

期待的结果

期望boost 库在 debug, release 模式都能正常编译

工程配置

add_rules("mode.release", "mode.debug")

add_requires("vcpkg::boost-locale", {alias = "boost-locale"}) -- add_requires("boost", {configs = {locale = true}})

target("imgex") set_kind("shared") add_files("src/.cpp") add_files("src/.c") set_languages("cxx17") add_packages("boost-locale") set_targetdir("/..")

附加信息和错误日志

error LNK2019: 无法解析的外部符号

jadedrip avatar Nov 06 '23 02:11 jadedrip

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


Title: vcpkg::boost link exception after generating cmakefiles

Xmake version

2.7.9

Operating system version and architecture

Windows

Describe the problem

I use xmake to import boost modules, such as add_requires("vcpkg::boost-locale", {alias = "boost-locale"})

Then generate cmakefiles through Xmake for compilation in visual studio As a result, the debug mode link was abnormal, and the troubleshooting found that there was a problem with the directory setting in cmakefiles. target_link_directories(geo PRIVATE When E:/vcpkg/installed/x64-windows-static/lib <= debug it should be E:/vcpkg/installed/x64-windows-static/debug/lib )

and target_link_libraries(xxxPRIVATE boost_locale-vc140-mt <= debug mode should be boost_locale-vc140-mt-gd )

Expected results

It is expected that the boost library can be compiled normally in debug and release modes.

Project configuration

add_rules("mode.release", "mode.debug")

add_requires("vcpkg::boost-locale", {alias = "boost-locale"}) -- add_requires("boost", {configs = {locale = true}})

target("imgex") set_kind("shared") add_files("src/.cpp") add_files("src/.c") set_languages("cxx17") add_packages("boost-locale") set_targetdir("/..")

Additional information and error logs

error LNK2019: Unresolved external symbol

Issues-translate-bot avatar Nov 06 '23 02:11 Issues-translate-bot