From 3813fd1bc97fa6bb2189cc9586f77be4c30478d6 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 2 Aug 2021 15:01:13 +0200 Subject: Introduce ECMQmlModule.cmake This contains some helper functions to make it easier to create QML modules through CMake. It takes care of several things that currently need to be done manually. It adds four tests for the four primary ways that it can be used, either as shared/static library and with or without C++ plugin. --- tests/ECMQmlModuleTest/CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/ECMQmlModuleTest/CMakeLists.txt (limited to 'tests/ECMQmlModuleTest/CMakeLists.txt') diff --git a/tests/ECMQmlModuleTest/CMakeLists.txt b/tests/ECMQmlModuleTest/CMakeLists.txt new file mode 100644 index 00000000..49d76594 --- /dev/null +++ b/tests/ECMQmlModuleTest/CMakeLists.txt @@ -0,0 +1,32 @@ +# +# SPDX-FileCopyrightText: 2021 Arjen Hiemstra +# +# SPDX-License-Identifier: BSD-3-Clause + +project(extra-cmake-modules) +cmake_minimum_required(VERSION 3.5) + +set(ECM_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../modules) +set(CMAKE_MODULE_PATH "${ECM_FIND_MODULE_DIR}" "${ECM_MODULE_DIR}") + +find_package(Qt5 REQUIRED COMPONENTS Qml) +include(ECMQmlModule) + +if(QML_ONLY) + ecm_add_qml_module(TestModule URI Test NO_PLUGIN) +else() + ecm_add_qml_module(TestModule URI Test) + target_sources(TestModule PRIVATE qmlmodule.cpp) + target_link_libraries(TestModule Qt5::Qml) +endif() + +if (DEPENDS) + ecm_add_qml_module_dependencies(TestModule DEPENDS OtherTest) +endif() + +ecm_target_qml_sources(TestModule SOURCES QmlModule.qml) + +ecm_finalize_qml_module(TestModule DESTINATION "test") + +# this will be run by CTest +configure_file(check.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/check.cmake" @ONLY) -- cgit v1.2.1