Skip to content

Commit 7afeb17

Browse files
authored
[CMake] Export compile commands by default (#364)
* [CMake] Export compile commands by default The compilation database should be useful for many LLVM development tasks, for example, debugging compilation of a specific TU in the test suite. It is fairly conservative, writing a single new file, whose size is ~9MiB for the default buil on macOS. Users which already enable it should not see any difference. Thus I think we should just write it by default. It shouldnt break tests. Guarding the setting by `if (CMAKE_EXPORT_COMPILE_COMMANDS STREQUAL "")` to enable users to restore old behavior if needed. `STREQUAL` is required because CMake defines this variable to `""` by default. LLVM already exports the compile commands, I think without even allowing a user override. Here we're even more conservative. * change 1 to ON
1 parent 62174ae commit 7afeb17

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,10 @@ if(TEST_SUITE_COLLECT_COMPILE_TIME)
330330
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_BINARY_DIR}/tools/timeit --summary <TARGET>.link.time ${CMAKE_CXX_LINK_EXECUTABLE}")
331331
endif()
332332

333+
if (CMAKE_EXPORT_COMPILE_COMMANDS STREQUAL "")
334+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
335+
endif()
336+
333337
option(TEST_SUITE_BENCHMARKING_ONLY "Only run the benchmarking only subset" OFF)
334338

335339
option(TEST_SUITE_COLLECT_STATS "Collect LLVM statistics" OFF)

0 commit comments

Comments
 (0)