CMake로 모든 것을 하나로 묶기
QML 모듈을 만들 때 CMake는 QML 유형을 올바르게 등록하고, 필요한 메타데이터를 생성하며, 모듈이 올바르게 패키징 및 배포될 수 있도록 인프라를 제공합니다. 이 페이지에서는 권장 워크플로우를 간략하게 설명합니다.
qt_add_qml_module 사용하기
qt_add_qml_module 명령은 QML 모듈을 생성하는 표준적이고 권장되는 방법입니다. 이 명령은 QML 모듈 생성의 모든 복잡한 세부 사항을 처리합니다:
qt_add_qml_module(my_qml_module
URI MyModule
QML_FILES
MyType.qml
AnotherType.qml
SOURCES
mytype.cpp mytype.h
)이 단일 명령은 다음과 같습니다:
- 모듈 대상을 생성합니다.
- C++ 및 QML 파일에서 QML 유형을 등록합니다.
- qmldir 파일 생성
- 유형 등록 처리
- 적절한 임포트 경로 설정
- QML 툴링 지원 활성화(qmllint, qmlls 등)
추가 QML 파일 추가
초기 qt_add_qml_module 호출 이후에 추가된 QML 파일의 경우 qt_target_qml_sources를 사용합니다:
qt_target_qml_sources(my_qml_module
QML_FILES
DynamicallyAddedType.qml
)플랫폼, 구성 또는 기타 요인에 따라 이 작업을 수행할 수 있습니다.
자세한 CMake 참조
모든 CMake 명령, 속성, 변수 및 정책에 대한 자세한 내용은 QML용 CMake 통합을 참조하세요.
QML 모듈 및 qt_add_qml_module도참조하세요 .
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.