@@ -171,7 +171,7 @@ Follow these instructions:
171
171
BUILD_ENV = MSVC
172
172
173
173
Open the Visual Studio Command prompt, and then bash.exe -login from
174
- Cygwin from in there.
174
+ Cygwin from in there.
175
175
176
176
3) Type cd src; make - that should do it.
177
177
@@ -183,6 +183,53 @@ can be used for building with MSBuild. Note that you still need to run
183
183
flex/bison using "make generated_files" before opening the project.
184
184
185
185
186
+ WORKING WITH CMAKE (EXPERIMENTAL)
187
+ ---------------------------------
188
+
189
+ There is an experimental build based on CMake instead of hand-written
190
+ makefiles. It should work on a wider variety of systems than the standard
191
+ makefile build, and can integrate better with IDEs and static-analysis tools.
192
+
193
+ 0) Run `cmake --version`. If you get a command-not-found error, or the installed
194
+ version is lower than 3.2, go and install a new version. Most Linux
195
+ distributions have a package for CMake, and Mac users can get it through
196
+ Homebrew. Windows users should download it manually from cmake.org.
197
+
198
+ 1) Create a directory to store your build:
199
+ `mkdir build`
200
+ Run this from the *top level* folder of the project. This is different from
201
+ the other builds, which require you to `cd src` first.
202
+
203
+ 2) Generate build files with CMake:
204
+ `cmake -H. -Bbuild`
205
+ This command tells CMake to use the configuration in the current directory,
206
+ and to generate build files into the `build` directory.
207
+ This is the point to specify custom build settings, such as compilers and
208
+ build back-ends. You can use clang (for example) by adding the argument
209
+ `-DCMAKE_CXX_COMPILER=clang++` to the command line. You can also tell
210
+ CMake to generate IDE projects by supplying the `-G` flag.
211
+ Run `cmake -G` for a comprehensive list of supported back-ends.
212
+
213
+ Generally it is not necessary to manually specify individual compiler or
214
+ linker flags, as CMake defines a number of "build modes" including Debug
215
+ and Release modes. To build in a particular mode, add the flag
216
+ `-DCMAKE_BUILD_TYPE=Debug` (or `Release`) to the initial invocation.
217
+
218
+ If you *do* need to manually add flags, use `-DCMAKE_CXX_FLAGS=...` and
219
+ `-DCMAKE_EXE_LINKER_FLAGS=...`. This is useful for enabling clang's
220
+ sanitizers.
221
+
222
+ Finally, to enable building universal binaries on macOS, you can pass the
223
+ flag `-DCMAKE_OSX_ARCHITECTURES=i386;x86_64`. If you don't supply this flag,
224
+ the build will just be for the architecture of your machine.
225
+
226
+ 3) Run the build:
227
+ `cmake --build build`
228
+ This command tells CMake to invoke the correct tool to run the build in the
229
+ `build` directory. You can also use the build back-end directly by invoking
230
+ `make`, `ninja`, or opening the generated IDE project as appropriate.
231
+
232
+
186
233
WORKING WITH ECLIPSE
187
234
--------------------
188
235
0 commit comments