I have created an R package that I would like to submit to CRAN. It contains code that needs to be compiled (plain C) and this code depends on the
As mentioned above, you can just copy over what the xml2 package does:
To get things to work on Linux/MacOS, copy the files
/src/Makevars.in. Note that macOS includes a copy of libxml2 by default, so you can safely link to
-lxml2 as you would do on Linux.
For Windows need to copy the files
tools/winlibs.R from xml2. This is a simple script that automatically downloads and statically links libxml2 from rwinlib when building the R package on Windows.
These build scripts are tested to work on (almost) any platform.