가져온 타깃
로드되는 각 Qt 모듈은 CMake 라이브러리 타깃을 정의합니다. 타깃 이름은 Qt6:: 로 시작하며, 그 뒤에 모듈 이름이 이어집니다. 예: Qt6::Core, Qt6::Gui. 해당 라이브러리를 사용하려면 라이브러리 타깃의 이름을 target_link_libraries 에 전달하십시오.
참고: 타깃은 Qt:: 접두사가 붙은 형태로도 사용할 수 있습니다: Qt::Core, Qt::Gui 등. Qt 5 및 Qt 6 호환성 항목도 참조하십시오.
임포트된 타깃은 Qt를 구성할 때와 동일한 구성으로 생성됩니다. 즉:
- Qt가
-debug스위치로 구성된 경우, DEBUG 구성을 가진 가져온 타깃이 생성됩니다. - Qt가 `
-release` 스위치로 구성된 경우, RELEASE 구성을 가진 가져온 타깃이 생성됩니다. - Qt가 `
-debug-and-release` 스위치로 설정된 경우, 가져온 타깃은 RELEASE 및 DEBUG 구성 모두로 생성됩니다.
프로젝트에 사용자 정의 CMake 빌드 구성이 있는 경우, 사용자 정의 구성을 Qt의 디버그 또는 릴리스 구성 중 하나에 매핑해야 합니다.
find_package(Qt6 REQUIRED COMPONENTS Core)
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage")
# set up a mapping so that the Release configuration for the Qt imported target is
# used in the COVERAGE CMake configuration.
set_target_properties(Qt6::Core PROPERTIES MAP_IMPORTED_CONFIG_COVERAGE "RELEASE")© 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.