새소식

Qt/Setup & Tips

QML module not found

  • -

Issue

  • QML module not found
  • Examples > Application Examples >Coffee Machine Project

Solution

  • CMakeLists.txt 에 project's Imports 경로 추가
  • add the following command to the CMakeLists.txt file to set the QML import path

CMakeLists.txt 에 Imports 경로 추가

# Directories where Qt Creator can find QML files.
# (Not needed for builds, but makes Qt Creator code completion happy.)
list(APPEND QML_IMPORT_PATH "/home/basiclike/Qt/Examples/Qt-6.5.2/demos/coffee/imports")

# Prevent adding duplicate values at each run of CMake.
list(REMOVE_DUPLICATES QML_IMPORT_PATH)

# The variable is cached in ${BUILD_DIR}/CMakeCache.txt. We need FORCE to 
# change it there immediately. Also, add a comment to the cache file.
set(QML_IMPORT_PATH ${QML_IMPORT_PATH}
    CACHE STRING ""
    FORCE
)

 

It works :)

Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.