I recently needed to build Apache Xerces (the C++ XML Parser) on Windows 10 using Microsoft Visual Studio 2019, this is a little guide describing the steps I took to build the various parts.
- the Xerces 3 Sources (I’v used v3.2.2)
- The ICU sources (make shure you checkout/grab the latest version, which includes fixes for this issue)
- Python (I’ve installed v3.8.1)
- CMake (I’ve installed v3.16.0)
Checkout the ICU sources from Github:https://github.com/unicode-org/icu using the latest “maint”-branch:
git clone -b maint/maint-66 git://github.com/unicode-org/icu.git
Change the Target SDK in the file Build.Windows.ProjectConfiguration.props (Line 63):
Execute the following commands in the “icu\icu4c” folder:
msbuild source\allinone\allinone.sln /p:Configuration=Release /p:Platform=x64 /p:SkipUWP=truex64 Debug
msbuild source\allinone\allinone.sln /p:Configuration=Debug /p:Platform=x64 /p:SkipUWP=true
it took ~ 3 minutes for a single complete build on my ThinkPad T480s (Quadcore i5, 24GB Ram).
Unpack the Xerces sources, launch the CMake GUI (cmake-gui), click “Browse Source…” select the root Xerces source folder.
Define two cache entries of type “Path”:
|ICU_ROOT||Root dirctory of the “icu4c” files|
|ICU_INCLUDE_DIR||Directory within the “icu4c” sources containing the “unicode” sub-folder|
Then press the “Configure”-button. When CMake asks for the generator select “Visual Studio 16 2019” (don’t change the rest) and hit “Finish”.
Let CMake detect all the things :).
You can ignore the “Policy CMP0074 is not set” warning (see)
When it’s finished it should look like this:
Now hit the “Generate”-button. Close the CMake-Gui and open the file “xerces-c.sln” with and elevated Visual Studio 2019 instance. Select “Build” -> “Batch Build” and hit the “Build” Button.
When everything is done, your freshley baked Xerces built is in “C:\Program Files (x86)\xerces-c”.