How to generate compiler_command.json using Xcode via CMake

Viewed 274

I was trying to generate compile_command.json file using CMAKE_EXPORT_COMPILE_COMMANDS for IOS, but CMake recognize this option CMAKE_EXPORT_COMPILE_COMMANDS only if we use Ninja Generator. "-G Ninja" and I am using XCode Generator.

1 Answers

xcodebuild -project path/to/.xcodeproj | xcpretty -r json-compilation-database --output path/for/compile_commands.json

Related