Skip to content

Commit b8d744b

Browse files
authored
Fix compile_commands.json generation in newer cmake versions [BUILD-286] (#132)
1 parent a2e709d commit b8d744b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

OldClangTidy.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
# will explicitly disable these targets from the command line at configure time
9696
#
9797

98+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Export compile commands" FORCE)
99+
98100
# Helper function to actually create the targets, not to be used outside this file
99101
function(create_clang_tidy_targets)
100102
set(argOption "")
@@ -222,10 +224,6 @@ function(swift_setup_clang_tidy)
222224
early_exit(STATUS "${PROJECT_NAME} clang-tidy support is DISABLED")
223225
endif()
224226

225-
# This is required so that clang-tidy can work out what compiler options to use
226-
# for each file
227-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Export compile commands" FORCE)
228-
229227
# Use a custom script if explicitly passed
230228
if(x_SCRIPT)
231229
if(EXISTS ${x_SCRIPT})

Sonarcloud.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
include(ListTargets)
5353

5454
set(_sonarcloud_newline "\\\n ")
55+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Export compile commands" FORCE)
5556

5657
function(_transform_sonarcloud_source_files output_variable target)
5758
#

0 commit comments

Comments
 (0)