Skip to content

Commit e009641

Browse files
authored
compile_commands.json should be generated for the whole project (#4503)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent 0fec913 commit e009641

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ set(UNITTESTS OFF CACHE BOOL "Build unit tests?")
5858
set(DOCTESTS OFF CACHE BOOL "Build doc tests?")
5959

6060
# Optional build settings
61-
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries?")
62-
set(ENABLE_AMALGAM OFF CACHE BOOL "Enable amalgamated build?")
63-
set(ENABLE_LTO ON CACHE BOOL "Enable LTO build?")
64-
set(ENABLE_STRIP ON CACHE BOOL "Enable stripping all symbols from release binary?")
61+
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries?")
62+
set(ENABLE_AMALGAM OFF CACHE BOOL "Enable amalgamated build?")
63+
set(ENABLE_LTO ON CACHE BOOL "Enable LTO build?")
64+
set(ENABLE_STRIP ON CACHE BOOL "Enable stripping all symbols from release binary?")
65+
set(ENABLE_COMPILE_COMMANDS ON CACHE BOOL "Enable generating compile_commands.json?")
6566

6667
# Option overrides
6768
if(NOT USING_CLANG)
@@ -116,6 +117,9 @@ if(CYGWIN OR MINGW OR MSYS)
116117
set(ENABLE_LTO_MESSAGE " (FORCED BY PLATFORM)")
117118
endif()
118119

120+
# Generate compile_commands.json
121+
set(CMAKE_EXPORT_COMPILE_COMMANDS ${ENABLE_COMPILE_COMMANDS})
122+
119123
# Status messages
120124
message(STATUS "CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE})
121125
message(STATUS "CMAKE_C_COMPILER_ID " ${CMAKE_C_COMPILER_ID})
@@ -125,6 +129,7 @@ message(STATUS "BUILD_SHARED_LIBS " ${BUILD_SHARED_LIBS})
125129
message(STATUS "ENABLE_AMALGAM " ${ENABLE_AMALGAM} ${ENABLE_AMALGAM_MESSAGE})
126130
message(STATUS "ENABLE_LTO " ${ENABLE_LTO} ${ENABLE_LTO_MESSAGE})
127131
message(STATUS "ENABLE_STRIP " ${ENABLE_STRIP} ${ENABLE_STRIP_MESSAGE})
132+
message(STATUS "ENABLE_COMPILE_COMMANDS " ${ENABLE_COMPILE_COMMANDS})
128133
message(STATUS "JERRY_VERSION " ${JERRY_VERSION})
129134
message(STATUS "JERRY_CMDLINE " ${JERRY_CMDLINE} ${JERRY_CMDLINE_MESSAGE})
130135
message(STATUS "JERRY_CMDLINE_TEST " ${JERRY_CMDLINE_TEST} ${JERRY_CMDLINE_TEST_MESSAGE})

jerry-main/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ project (jerry-main C)
1717

1818
# Optional build settings
1919
set(ENABLE_LINK_MAP OFF CACHE BOOL "Enable generating a link map file?")
20-
set(ENABLE_COMPILE_COMMANDS ON CACHE BOOL "Enable generating compile_commands.json?")
2120
set(JERRY_TEST_STACK_MEASURE OFF CACHE BOOL "Enable stack measurement for the jerry-test binary?")
2221

2322
# Status messages
2423
message(STATUS "ENABLE_LINK_MAP " ${ENABLE_LINK_MAP})
25-
message(STATUS "ENABLE_COMPILE_COMMANDS " ${ENABLE_COMPILE_COMMANDS})
2624
message(STATUS "JERRY_TEST_STACK_MEASURE " ${JERRY_TEST_STACK_MEASURE})
2725

2826
# Generate map file
@@ -34,9 +32,6 @@ if(ENABLE_LINK_MAP)
3432
endif()
3533
endif()
3634

37-
# Generate compile_commands.json
38-
set(CMAKE_EXPORT_COMPILE_COMMANDS ${ENABLE_COMPILE_COMMANDS})
39-
4035
# Get version information from git
4136
if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/.git")
4237
execute_process(COMMAND git rev-parse --short HEAD

0 commit comments

Comments
 (0)