Spreadsheets Example: Fix Installation and Deployment

After installing the example outside the build directory using
`cmake --install --prefix`, the installed application could not run
because the Spreadsheet subproject library was not found at runtime.

To fix this issue, the Spreadsheets subproject has been added as a
static library to the project. Now, it can be found in the installed
directory.

Fixes: QTBUG-127846
Pick-to: 6.8
Change-Id: I30968afa958ec6bda6017969de157e27550a7616
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
MohammadHossein Qanbari 2024-08-22 11:10:31 +02:00
parent 81c95fb650
commit 371efb4ca2
2 changed files with 6 additions and 4 deletions

View File

@ -6,7 +6,7 @@ project(SpreadsheetsExample VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 6.8 REQUIRED COMPONENTS Gui Qml)
find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui Qml Quick)
qt_standard_project_setup(REQUIRES 6.8)
@ -17,9 +17,11 @@ qt_add_executable(${PROJECT_NAME} WIN32
)
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Qml
Spreadsheets
Qt6::Quick
Spreadsheetsplugin
)
qt_add_resources(${PROJECT_NAME} "spareadsheet_icon"

View File

@ -4,11 +4,11 @@
cmake_minimum_required(VERSION 3.16)
project(Spreadsheets LANGUAGES CXX)
find_package(Qt6 6.8 REQUIRED COMPONENTS Core Quick Qml)
qt_standard_project_setup(REQUIRES 6.8)
qt_add_library(${PROJECT_NAME} STATIC)
qt_add_qml_module(${PROJECT_NAME}
URI Spreadsheets
URI ${PROJECT_NAME}
VERSION 1.0
QML_FILES
Main.qml