Added README description for CMake

This commit is contained in:
Vitaliy Kirsanov 2019-05-01 01:07:09 +03:00 committed by Erik de Castro Lopo
parent 26cbd97884
commit 95a94232a8
1 changed files with 82 additions and 0 deletions

82
README
View File

@ -52,6 +52,7 @@ FLAC - 1.3.2 - Contents
- Building with Makefile.lite
- Building with MSVC
- Building on Mac OS X
- Building with CMake
===============================================================================
@ -252,3 +253,84 @@ Building on Mac OS X
If you have Fink or a recent version of OS X with the proper autotools,
the GNU flow above should work.
===============================================================================
Building with CMake
===============================================================================
CMake is a cross-platform build system. FLAC can be built on Windows, Linux, Mac
OS X using CMake.
You can use either CMake's CLI or GUI. We recommend you to have a separate build
folder outside the repository in order to not spoil it with generated files.
CLI
---
Go to your build folder and run something like this:
/path/to/flac/build$ cmake /path/to/flac/source
or e.g. in Windows shell
C:\path\to\flac\build> cmake \path\to\flac\source
(provided that cmake is in your %PATH% variable)
That will generate build scripts for the default build system (e.g. Makefiles
for UNIX). After that you start build with a command like this:
/path/to/flac/build$ make
And afterwards you can run tests or install the built libraries and headers
/path/to/flac/build$ make test
/path/to/flac/build$ make install
If you want use a build system other than default add -G flag to cmake, e.g.:
/path/to/flac/build$ cmake /path/to/flac/source -GNinja
/path/to/flac/build$ ninja
or:
/path/to/flac/build$ cmake /path/to/flac/source -GXcode
Use cmake --help to see the list of available generators.
If you have OGG on your system you can tell CMake to use it:
/path/to/flac/build$ cmake /path/to/flac/source -DWITH_OGG=ON
If CMake fails to find it you can help CMake by specifying the exact path:
/path/to/flac/build$ cmake /path/to/flac/source -DWITH_OGG=ON -DOGG_ROOT=/path/to/ogg
CMake will search for OGG by default so if you don't have it you can tell
cmake to not do so:
/path/to/flac/build$ cmake /path/to/flac/source -DWITH_OGG=OFF
Other FLAC's options (e.g. building C++ lib or docs) can also be put to cmake
through -D flag.
GUI
---
It is likely that you would prefer to use it on Windows building for Visual
Studio. It's in essence the same process as building using CLI.
Open cmake-gui. In the window select a source directory (the repository's
root), a build directory (some other directory outside the repository). Then
press button "Configure". CMake will ask you which build system you prefer.
Choose that version of Visual Studio which you have on your system, choose
whether you want to build for x86 or amd64. Press OK. After CMake finishes
press "Generate" button, and after that "Open Project". In response CMake
will launch Visual Studio and open the generated solution. You can use it as
usual but remember that it was generated by CMake. That means that your
changes (e.g. some addidional compile flags) will be lost when you run CMake
next time.
Again, if you have OGG on your system set WITH_OGG flag in the list of
variables in cmake-gui window before you press "Configure".
If CMake fails to find MSVC compiler then running cmake-gui from MS Developer
comand prompt should help.