diff options
| author | Juan Ramos <juan@lunarg.com> | 2022-10-26 10:18:28 -0600 |
|---|---|---|
| committer | Juan Ramos <114601453+juan-lunarg@users.noreply.github.com> | 2022-10-26 12:01:46 -0600 |
| commit | bb33921621b48770486683d9cc4ebef35b4a6f9a (patch) | |
| tree | 75550861232ed7c2e51f254ecc3bd751a5b164ac | |
| parent | 9ef27c9137ab5baa40999290ed836841d0861786 (diff) | |
| download | usermoji-bb33921621b48770486683d9cc4ebef35b4a6f9a.tar.xz | |
docs: Explain CMAKE_EXPORT_COMPILE_COMMANDS
| -rw-r--r-- | BUILD.md | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -234,6 +234,26 @@ export CMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache cmake ... -D CMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache -D CMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache ``` +### EXPORT_COMPILE_COMMANDS + +There are 2 methods to enable exporting compile commands: + +1.) Set environment variables + +```bash +# Requires CMake 3.17 (https://cmake.org/cmake/help/latest/envvar/CMAKE_EXPORT_COMPILE_COMMANDS.html) +export CMAKE_EXPORT_COMPILE_COMMANDS=ON +``` + +2.) Pass in cache variables + +``` +cmake ... -D CMAKE_EXPORT_COMPILE_COMMANDS=ON +``` + +NOTE: Modern tools will generally enable exporting compile commands for you (e.g. VSCode). +Also `CMAKE_EXPORT_COMPILE_COMMANDS` is implemented only by Makefile and Ninja generators. For other generators, this option is ignored. + ## Building On Windows ### Windows Development Environment Requirements |
