blob: 37f7c539fe5346ce2f7c0f0a6af0047f91303aa1 [file] [log] [blame]
Haibo Huang40a71912019-10-11 11:13:39 -07001== How to build expat with cmake (experimental) ==
2
3The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual
4Studio) and should work on all other platform cmake supports.
5
Elliott Hughesf898dc22022-02-23 17:34:51 -08006Assuming ~/expat-2.4.6 is the source directory of expat, add a subdirectory
Haibo Huang40a71912019-10-11 11:13:39 -07007build and change into that directory:
Elliott Hughesf898dc22022-02-23 17:34:51 -08008~/expat-2.4.6$ mkdir build && cd build
9~/expat-2.4.6/build$
Haibo Huang40a71912019-10-11 11:13:39 -070010
11From that directory, call cmake first, then call make, make test and
12make install in the usual way:
Elliott Hughesf898dc22022-02-23 17:34:51 -080013~/expat-2.4.6/build$ cmake ..
Haibo Huang40a71912019-10-11 11:13:39 -070014-- The C compiler identification is GNU
15-- The CXX compiler identification is GNU
16....
17-- Configuring done
18-- Generating done
Elliott Hughesf898dc22022-02-23 17:34:51 -080019-- Build files have been written to: /home/patrick/expat-2.4.6/build
Haibo Huang40a71912019-10-11 11:13:39 -070020
21If you want to specify the install location for your files, append
22-DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call.
23
Elliott Hughesf898dc22022-02-23 17:34:51 -080024~/expat-2.4.6/build$ make && make test && make install
Haibo Huang40a71912019-10-11 11:13:39 -070025Scanning dependencies of target expat
26[ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o
27[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o
28....
29-- Installing: /usr/local/lib/pkgconfig/expat.pc
30-- Installing: /usr/local/bin/xmlwf
31-- Installing: /usr/local/share/man/man1/xmlwf.1
32
33For Windows builds, you must make sure to call cmake from an environment where
34your compiler is reachable, that means either you call it from the
35Visual Studio Command Prompt or when using mingw, you must open a cmd.exe and
36make sure that gcc can be called. On Windows, you also might want to specify a
37special Generator for CMake:
38for Visual Studio builds do:
39cmake .. -G "Visual Studio 15 2017" && msbuild /m expat.sln
40for mingw builds do:
41cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:\expat-install
42 && gmake && gmake install