qt_generate_moc

입력 파일에서 moc를 호출합니다.

이 명령은 Qt6 패키지의 Core 컴포넌트에 정의되어 있으며, 다음과 같이 로드할 수 있습니다:

find_package(Qt6 REQUIRED COMPONENTS Core)

이 명령은 Qt 5.0에 도입되었습니다.

개요

qt_generate_moc(src_file dest_file
                [TARGET target])

버전 없는 명령을 사용할 수 없는 경우 qt6_generate_moc() 을 대신 사용합니다. 이 명령은 이 명령과 동일한 인수 집합을 지원합니다.

설명

src_file 에서 Meta-Object Compiler (moc) 을 호출하고 dest_file 에 출력을 저장하는 규칙을 만듭니다.

참고: 이것은 저수준 매크로입니다. 소스 파일을 moc 으로 처리하는 더 편리한 방법은 CMake AUTOMOC 문서를 참조하세요. qt_wrap_cpp도 비슷하지만 임시 파일 경로를 자동으로 생성합니다.

인수

명시적으로 TARGET 을 설정할 수 있습니다. 이렇게 하면 moc 로 소스 파일을 검사할 때 대상 속성 INCLUDE_DIRECTORIESCOMPILE_DEFINITIONS 도 사용되도록 합니다.

예제

qt_generate_moc(main.cpp main.moc TARGET myapp)

© 2025 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.