CMake 프리셋으로 빌드하기
프로젝트를 빌드할 때 CMake 키트를 사용하는 대신 CMakePresets.json 파일에서 빌드 옵션을 설정할 수 있습니다. CMake에 설명된 형식의 프리셋 파일( cmake-presets(7)을 생성하고 프로젝트의 루트 디렉터리에 저장합니다.
VS 코드용 Qt 익스텐션은 CMake 익스텐션이 지원하는 모든 필드를 읽고 사용합니다.
사전 설정 구성하기
다음 구성 사전 설정은 사용자가 CMAKE_TOOLCHAIN_FILE 에서 설정한 Qt 버전으로 디버그 빌드를 수행하도록 CMake에 지시합니다:
{
"version": 3,
"configurePresets": [
{
"name": "debug",
"displayName": "my debug configure preset",
"binaryDir": "build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_TOOLCHAIN_FILE": "C:\Qt\6.9.1\msvc2022_64\lib\cmake\Qt6\qt.toolchain.cmake"
}
]
}다음 섹션에서는 CMake 프리셋을 사용하여 Qt를 등록하는 다른 방법을 설명합니다.
CMake 변수
CMAKE_TOOLCHAIN_FILE 대신 다음 키 중 하나를 사용할 수도 있습니다:
CMAKE_PREFIX_PATHQt5_DIRQt6_DIRQt6_ROOTQT_ADDITIONAL_PACKAGES_PREFIX_PATHQT_PACKAGES_PREFIX_PATHQt_ROOTQTDIR
CMake 사전 설정 구성
CMake 키 대신 toolchainFile CMake 구성 프리셋을 사용하여 툴체인 파일의 경로를 설정할 수 있습니다:
{
"version": 3,
"configurePresets": [
{
"name": "debug",
"displayName": "my debug configure preset",
"binaryDir": "build-debug",
},
"toolchainFile": "/home/user/vcpkg/scripts/buildsystems/vcpkg.cmake"
]
}Qt 벤더 프리셋
Qt 벤더 프리셋을 사용하여 Qt 설치를 등록할 수도 있습니다.
Qt 설치 경로를 설정하려면 VSCODE_QT_INSTALLATION 을 사용합니다:
"vendor": {
"qt-cpp": {
"VSCODE_QT_INSTALLATION": "C:\Qt\6.9.1\msvc2022_64"
}
}qtpaths 로 경로를 설정하려면 VSCODE_QT_QTPATHS_EXE 을 선택합니다:
"vendor": {
"qt-cpp": {
"VSCODE_QT_QTPATHS_EXE": "C:\Qt\6.9.1\msvc2022_64\bin\qtpaths"
}
}Qt 설치 등록하기를참조하십시오 .
© 2024 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.