@@ -58,10 +58,11 @@ set(UNITTESTS OFF CACHE BOOL "Build unit tests?")
5858set (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
6768if (NOT USING_CLANG)
@@ -116,6 +117,9 @@ if(CYGWIN OR MINGW OR MSYS)
116117 set (ENABLE_LTO_MESSAGE " (FORCED BY PLATFORM)" )
117118endif ()
118119
120+ # Generate compile_commands.json
121+ set (CMAKE_EXPORT_COMPILE_COMMANDS ${ENABLE_COMPILE_COMMANDS} )
122+
119123# Status messages
120124message (STATUS "CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE} )
121125message (STATUS "CMAKE_C_COMPILER_ID " ${CMAKE_C_COMPILER_ID} )
@@ -125,6 +129,7 @@ message(STATUS "BUILD_SHARED_LIBS " ${BUILD_SHARED_LIBS})
125129message (STATUS "ENABLE_AMALGAM " ${ENABLE_AMALGAM} ${ENABLE_AMALGAM_MESSAGE} )
126130message (STATUS "ENABLE_LTO " ${ENABLE_LTO} ${ENABLE_LTO_MESSAGE} )
127131message (STATUS "ENABLE_STRIP " ${ENABLE_STRIP} ${ENABLE_STRIP_MESSAGE} )
132+ message (STATUS "ENABLE_COMPILE_COMMANDS " ${ENABLE_COMPILE_COMMANDS} )
128133message (STATUS "JERRY_VERSION " ${JERRY_VERSION} )
129134message (STATUS "JERRY_CMDLINE " ${JERRY_CMDLINE} ${JERRY_CMDLINE_MESSAGE} )
130135message (STATUS "JERRY_CMDLINE_TEST " ${JERRY_CMDLINE_TEST} ${JERRY_CMDLINE_TEST_MESSAGE} )
0 commit comments