前言
花了半天时间想要把xlnt 集成到VS2022 Cmake项目中,以我目前掌握的能力,Cmake语法对于我来说难懂,对于只是使用过Cmake编译MySQL,或是其他lib,dll库的小白来说,不应该为了显示自己能力多么出众,强行去配置一些程序内容。
生活中没有绝对的事情,有舍有得.
https://github.com/tfussell/xlnt
VS2022,打开xlnt的source文件夹,直接用CMakeLists进行编译库.
会提示如下信息
...
-- Configuring done (3.6s)
CMake Error at C:/Users/38684/Downloads/xlnt-master/xlnt-master/third-party/libstudxml.build/CMakeLists.txt:52 (add_library):
Cannot find source file:
C:/Users/38684/Downloads/xlnt-master/xlnt-master/third-party/libstudxml/libstudxml/parser.cxx
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
.ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
.f95 .f03 .hip .ispc
CMake Error at C:/Users/38684/Downloads/xlnt-master/xlnt-master/third-party/libstudxml.build/CMakeLists.txt:52 (add_library):
No SOURCES given to target: libstudxml
CMake Generate step failed. Build files cannot be regenerated correctly.
https://github.com/kamxgal/libstudxml
将libstudxml-master中的libstudxml 放入 xlnt-master中的 third-party
会遇到 GB2312 936编码 与Unicode编码不一致的问题.
这似乎在提醒诸位,使用Windows C++ 编程的时候,尽量使用Unicode编码.