if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) message(FATAL_ERROR "MyStyle should be built as part of the 'attachedstyleproperties' project, and not in isolation.") endif() qt_policy(SET QTP0001 NEW) qt_add_qml_module(MyStyle URI MyStyle IMPORTS QtQuick.Controls.Material QML_FILES ApplicationWindow.qml Button.qml Label.qml Popup.qml Switch.qml ToolBar.qml SOURCES mystyle.cpp mystyle.h ) include(GenerateExportHeader) target_include_directories(MyStyle PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) # find autogenerated header generate_export_header(MyStyle) find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml QuickControls2) target_link_libraries(MyStyle PRIVATE Qt6::Core Qt6::Gui Qt6::Qml Qt6::QuickControls2 ) install(TARGETS MyStyle BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install(TARGETS MyStyleplugin RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/MyStyle" LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}/MyStyle" ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir DESTINATION "${CMAKE_INSTALL_BINDIR}/MyStyle" )