From 529753b0782c66b637c5a5ca72c79c744bb443f6 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 5 Dec 2024 01:22:57 +0100 Subject: [PATCH] Fix qmlls & clang LSP issues This makes cmake export the qmlls.ini settings for qmlls (lang server), which makes it aware of the C++ components used in the project. By default, qmlls wasn't able to find these as they lived in a separate build dir which it didn't know about. Additionally, this also enables exporting compile commands to provide better support for other editors that rely on these. Note that the compile_commands.json will still only be exported into the build dir though, so to make use of this, you'll probably want to symlink this from the build dir. --- .gitignore | 1 + CMakeLists.txt | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index eb15581..49fbd17 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ Thumbs.db *.rc /.qmake.cache /.qmake.stash +compile_commands.json # qtcreator generated files *.pro.user* diff --git a/CMakeLists.txt b/CMakeLists.txt index bcc5714..51e95bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,10 @@ project(Solitare VERSION 0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(Qt6 6.5 REQUIRED COMPONENTS Quick) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(QT_QML_GENERATE_QMLLS_INI ON) +find_package(Qt6 6.5 REQUIRED COMPONENTS Quick) qt_standard_project_setup(REQUIRES 6.5) set(CMAKE_AUTORCC ON)