반응형
# 문제 상황
'brew install qt5'로 qt5는 설치하였으나 find_package로 내부 파일을 찾지 못하여 다음과 같은 메시지가 떴다.
CMake Error at src/CMakeLists.txt:2 (find_package):
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5" with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.
# 해결 방안
% brew --prefix qt5
/opt/homebrew/opt/qt@5
CMakeLists.txt 파일에서 find_package 전에 CMAKE_PREFIX_PATH를 위의 경로로 지정하여 해당 패키지를 찾을 수 있도록 한다.
set(CMAKE_PREFIX_PATH "/opt/homebrew/opt/qt@5")
...
find_package(Qt5 COMPONENTS Widgets Charts DataVisualization REQUIRED)
# 참고
- [StackOverFlow] MacOS Sierra - cmake failed with qt5: https://stackoverflow.com/questions/40081327/macos-sierra-cmake-failed-with-qt5
반응형