sanitycheck: export compile commands on --cmake-only

export compile commands when running with --cmake-only, this can be used
for analysis and coverage statistics.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
diff --git a/scripts/sanitycheck b/scripts/sanitycheck
index c0f7ac2..ca4ebd0 100755
--- a/scripts/sanitycheck
+++ b/scripts/sanitycheck
@@ -1841,6 +1841,9 @@
                 '-G{}'.format(get_generator()[1])
                 ]
 
+        if options.cmake_only:
+            cmake_args.append("-DCMAKE_EXPORT_COMPILE_COMMANDS=1")
+
         args = ["-D{}".format(a.replace('"', '')) for a in args]
         cmake_args.extend(args)