Generate compiler command information during build (#4382)
author이성재/On-Device Lab(SR)/Principal Engineer/삼성전자 <sj925.lee@samsung.com>
Thu, 7 Feb 2019 08:17:30 +0000 (17:17 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 7 Feb 2019 08:17:30 +0000 (17:17 +0900)
* Generate compiler command information during build

- 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 34824ff..0979a4a 100644 (file)
@@ -12,6 +12,13 @@ endmacro(nnfw_find_package)
 
 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)
+
 # identify platform: HOST_PLATFORM, TARGET_PLATFORM and related
 include("cmake/option/identify_platform.cmake")