Enable export of compile commands database

For developer builds, enable the compile commands database by default.
This allows Qt developers to use tools that utilize these (such as
clang-tidy, etc.) without any extra setup.

Change-Id: I79d70ef7dbe7c59864e93593c75f9ff6cd67c2ce
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
This commit is contained in:
Simon Hausmann 2019-05-26 16:55:15 +02:00
parent cbb143e9f1
commit f96778dee2

View File

@ -35,6 +35,11 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if(FEATURE_developer_build)
if(DEFINED QT_CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ${QT_CMAKE_EXPORT_COMPILE_COMMANDS})
else()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
set(QT_WILL_INSTALL OFF)
# Handle non-prefix builds by setting the cmake install prefix to the project binary dir.
if(PROJECT_NAME STREQUAL "QtBase")