Generate compiler command information during build (#3100)
author이성재/On-Device Lab(SR)/Principal Engineer/삼성전자 <sj925.lee@samsung.com>
Fri, 22 Mar 2019 00:59:00 +0000 (09:59 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 22 Mar 2019 00:59:00 +0000 (09:59 +0900)
- Set CMAKE_EXPORT_COMPILE_COMMANDS option to generate
  compile_commands.json file while cmake build.
- It will be used to generate semantic information from various tools.
- Leave a comment about unsupported feature in CMake version 3.1.0

Signed-off-by: Sung-Jae Lee <sj925.lee@samsung.com>
CMakeLists.txt

index 8f06a7f..7c116c0 100644 (file)
@@ -6,6 +6,13 @@ enable_testing()
 
 set(CMAKE_CXX_STANDARD 11)
 
+# This feature works with CMake 3.5.2 or later. However, using previous versions does not produce
+# an error. We are still officially using CMake 3.1.0, but put this code for the sake of semantic
+# support in various development tools.
+# Todo: Someday, CMake needs to be updated to 3.7.2 or later to take advantage of improvements
+#       such as `cmake-server`.
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
 set(NNCC_OVERLAY_DIR "${CMAKE_BINARY_DIR}/overlay" CACHE
     INTERNAL "Where locally built external dependencies are installed")