개발환경/CLion
CLion: Ignoring CMAKE_OSX_SYSROOT value 에러 해결 (MacOS)
오늘도 야근
2022. 3. 19. 13:36
MacOS에 CLion(2020.3.4 버전)을 설치하여 사용하고 있었는데, MacOS를 Big Sur로 업데이트한 후에 CLion에서 CMake를 reload해 보니 다음과 같은 에러가 발생하였다.
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/gyun/workspace/v2x-sw
CMake Warning at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.17/Modules/Platform/Darwin-Initialize.cmake:286 (message):
Ignoring CMAKE_OSX_SYSROOT value:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
because the directory does not exist.
대충 해석해 보면 CMAKE_OSX_SYSROOT로 설정되어 있는 "/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk" 디렉토리가 존재하지 않아 발생한 에러인 것 같다.
터미널을 열어 해당 디렉토리(/Library/Developer/CommandLineTools/SDKs/)로 이동해 보니, 다른 버전의 디렉토리는 있는데 MacOSX11.1.sdk 디렉토리는 존재하지 않는다.
% ls /Library/Developer/CommandLineTools/SDKs
MacOSX.sdk MacOSX11.sdk MacOSX12.1.sdk MacOSX12.sdk
MacOSX11.3.sdk MacOSX12.0.sdk MacOSX12.3.sdk
그렇다면 CMAKE_OSX_SYSROOT 설정값을 저 디렉토리 중 하나로 설정하면 될 것 같다.
CMake documentation 싸이트를 검색해 보면, 수동으로 CMakeLists.txt 파일에 직접 CMAKE_OSX_SYSROOT를 정의하면 된다는데, 그 방법은 왠지 정답은 아닌 듯 하다.
결론적으로, CLion에서 "Tools" → "CMake" → "Reset Cache and Reload Project" 메뉴를 실행하면 자동으로 재설정되고 다음과 같이 출력되면서 에러가 해결된다.
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/h3ngss0/workspace/
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done