Installing LibXML2 & LibXMLmm on Windows

LibXML2

This one is pretty easy though.

First make some modifications with CMakeLists.txt, turning off the dependencies you do not have and do not want to install. For me,

- option(LIBXML2_WITH_ICONV "Add ICONV support" ON)
+ option(LIBXML2_WITH_ICONV "Add ICONV support" OFF)

- option(LIBXML2_WITH_LZMA "Use liblzma" ON)
+ option(LIBXML2_WITH_LZMA "Use liblzma" OFF)

# This requires Python 2
- option(LIBXML2_WITH_PYTHON "Build Python bindings" ON)
+ option(LIBXML2_WITH_PYTHON "Build Python bindings" OFF)

- option(LIBXML2_WITH_TESTS "Build tests" ON)
+ option(LIBXML2_WITH_TESTS "Build tests" OFF)

- option(LIBXML2_WITH_ZLIB "Use libz" ON)
+ option(LIBXML2_WITH_ZLIB "Use libz" OFF)

And then, as always,

mkdir build && cd build
cmake .. -G <MSVC>
cmake --build .
cmake --install .

Then, add bin and lib/pkgconfig to your PATH. Slightly modify your lib/pkgconfig/libxml-2.0.pc:

Notes

LibXMLmm

Do the followings in git bash:

Have a try!

Note that you may need specifying something in the CMakeLists.txt. Download this test gist and run under root of repo:

mkdir bin && mkdir build && cd build
cmake .. -G "Unix Makefiles"
cmake --build .
cd ../bin
./test.exe
cat index.html

And you should get the same HTML as the example.

Congrats!


Copyright (c) ksyx 2021, licensed under CC-BY-SA. Download Markdown file at libxml.md

< Back to posts