본문 바로가기

컴퓨터 과학/꿀팁

vscode cmake 오류 해결

반응형

 

 

환경 변수가 많이 꼬여 있어서 오늘 한 번 정리를 했다.(정말 조심스러운 일이었다;;)

vscode의 cmake를 사용하면서 두 가지 문제가 발생하였다. 하나는 cmake path를 인식하지 못해서 프로젝트 빌드를 못한다는 것, 두 번 째는경 변수가 많이 꼬여 있어서 오늘 한 번 정리를 했다. 

 

vscode의 cmake를 사용하면서 두 가지 문제가 발생하였다. 하나는 cmake path를 인식하지 못해서 프로젝트 빌드를 못한다는 것, 두 번 째는 cmake 내 빌드를 ninja로 하는데, 제대로 인식하지 못했다는 점이다.

 

해결 방법은 setting.json 파일에서 다음과 같은 내용을 추가해 주면 된다.(팔렛트 open -> preference:open user setting(json))

"cmake.cmakePath": "C:/Program Files/CMake/bin/cmake.exe",
"debug.onTaskErrors": "abort",
"cmake.generator": "Ninja",
"cmake.preferredGenerators": ["Ninja"]

 

내 경우 이렇게 setting 되어 있다.(그냥 어느 위치에 추가해 주어야 하는지 정도만 참고할 것)

{
    "qt-core.qtInstallationRoot": "d:\\library\\Qt",
    "explorer.confirmDelete": false,
    "open-in-browser.default": "Chrome",
    "cmake.defaultVariants": {
        "buildType": {
            "default": "debug",
            "description": "The build type.",
            "choices": {
                "debug": {
                    "short": "Debug",
                    "long": "Disable optimizations - include debug information.",
                    "buildType": "Debug"
                },
                "release": {
                    "short": "Release",
                    "long": "Optimize for speed - exclude debug information.",
                    "buildType": "Release"
                },
                "minsize": {
                    "short": "MinSizeRel",
                    "long": "Optimize for smallest binary size - exclude debug information.",
                    "buildType": "MinSizeRel"
                },
                "reldeb": {
                    "short": "RelWithDebInfo",
                    "long": "Optimize for speed - include debug information.",
                    "buildType": "RelWithDebInfo"
                },
                "unspecified": {
                    "short": "Unspecified",
                    "long": "Let CMake pick the default build type.",
                    "buildType": "Unspecified"
                }
            },
        }
    },
    "cmake.cmakePath": "C:/Program Files/CMake/bin/cmake.exe",
    "debug.onTaskErrors": "abort",
    "cmake.generator": "Ninja",
    "cmake.preferredGenerators": ["Ninja"]
}

 

도움이 되기를 바란다!

반응형

'컴퓨터 과학 > 꿀팁' 카테고리의 다른 글

vim 사용(퍼옴)  (0) 2025.05.05
vscode tutorial  (0) 2025.04.24
Ubunut에서 chrome, vscode 깔기  (0) 2025.04.22
Ubuntu - 한글 입력 설정  (0) 2025.04.21
컴퓨터에 리눅스 까는 법  (0) 2025.03.13