# Copy compile_commands.json to source directory if (CMAKE_EXPORT_COMPILE_COMMANDS) add_custom_target( CopyCompileCommands ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/compile_commands.json ${CMAKE_SOURCE_DIR}/compile_commands.json COMMENT "Copying compile_commands.json to source directory" ) endif()