当我尝试将32位库与64位项目链接时,如何使Cmake警告和抱怨?
我的项目取决于许多旧书库(从〜2000起)。当时,大多数库以32位而不是64位编译(现在是主流)。构建它们并不容易,而且它们的源代码也不完全可用。
我使用cmake
在win10上构建我的项目,链接这些旧版库。 cmakelists.txt
就像
# collect all libaries
set(legacy_libs legacy1_32bit.lib legacy2_64bit.lib)
# set up targt
add_library(mylib1 lib1.cpp)
add_executable(main main.cpp)
target_link_libraries(main ${legacy_libs})
cmake
在我混合32位和64位库时不会兼容任何内容,但是只需报告未解决的外部符号
。
此错误消息有时会使初学者感到困惑。
如何强制cmake
检查LIB版本的一致性,并将其报告给用户?如果是这样,调试过程可以更有效。
I have a project which is dependent on many legacy libraries (from ~2000). At that time, most of libraries are compiled in 32 bit instead of 64 bit (which is mainstream now). It is not very easy to build them, and their source codes are also not quite available.
I use cmake
to build my project on win10, link these legacy libraries. CMakeLists.txt
is like
# collect all libaries
set(legacy_libs legacy1_32bit.lib legacy2_64bit.lib)
# set up targt
add_library(mylib1 lib1.cpp)
add_executable(main main.cpp)
target_link_libraries(main ${legacy_libs})
cmake
doesn't compalint anything when I mix 32 bit and 64 bit libraries, but just report unresolved external symbol
.
And this error message is sometimes confusing for beginners.
How to force cmake
to check the lib version consistency, and report it to the user? If so, the debug processdure can be more efficient.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论