From: Juan Ramos Date: Wed, 26 Oct 2022 16:18:28 +0000 (-0600) Subject: docs: Explain CMAKE_EXPORT_COMPILE_COMMANDS X-Git-Tag: upstream/1.3.240~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb33921621b48770486683d9cc4ebef35b4a6f9a;p=platform%2Fupstream%2FVulkan-Tools.git docs: Explain CMAKE_EXPORT_COMPILE_COMMANDS --- diff --git a/BUILD.md b/BUILD.md index d8b4b49..2058220 100644 --- a/BUILD.md +++ b/BUILD.md @@ -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