Problem with Build in QML
-
CMake project configuration failed ?
could you please show us your CMakeLists.txt file ? -
CMake project configuration failed ?
could you please show us your CMakeLists.txt file ?@ankou29666 of course
cmake_minimum_required(VERSION 3.16) project(untitled VERSION 0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 REQUIRED COMPONENTS Quick) qt_standard_project_setup(REQUIRES 6.8) qt_add_executable(appuntitled main.cpp ) qt_add_qml_module(appuntitled URI untitled VERSION 1.0 QML_FILES Main.qml ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # If you are developing for iOS or macOS you should consider setting an # explicit, fixed bundle identifier manually though. set_target_properties(appuntitled PROPERTIES # MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appuntitled MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) target_link_libraries(appuntitled PRIVATE Qt6::Quick ) include(GNUInstallDirs) install(TARGETS appuntitled BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
-
I don't remember what is the error message displayed in that case but all I notice is that you define a target name but next define properties for another target name.
either you rename your project to appuntitled, or you rename it untitled everywhere else. But mixing "untitled" in project definition with "appuntitled" everywhere else won't work for sure.
Best practice is to use ${PROJECT_NAME} variable :
project (somename blablabla) qt_add_executable (${PROJECT_NAME} yourfiles) qt_add_qml_module (${PROJECT_NAME} URI your.project.uri RESOURCE_PREFIX someprefix VERSION 1.0 QML_FILES YourQmlFiles.qml )
it's more reliable template than QtCreator's defaults.
-
I don't remember what is the error message displayed in that case but all I notice is that you define a target name but next define properties for another target name.
either you rename your project to appuntitled, or you rename it untitled everywhere else. But mixing "untitled" in project definition with "appuntitled" everywhere else won't work for sure.
Best practice is to use ${PROJECT_NAME} variable :
project (somename blablabla) qt_add_executable (${PROJECT_NAME} yourfiles) qt_add_qml_module (${PROJECT_NAME} URI your.project.uri RESOURCE_PREFIX someprefix VERSION 1.0 QML_FILES YourQmlFiles.qml )
it's more reliable template than QtCreator's defaults.
@ankou29666 said in Problem with Build in QML:
I don't remember what is the error message displayed in that case but all I notice is that you define a target name but next define properties for another target name.
I didn't know that, cmake is automatically generated by Qt Creator. I will try it.
-
I don't remember what is the error message displayed in that case but all I notice is that you define a target name but next define properties for another target name.
either you rename your project to appuntitled, or you rename it untitled everywhere else. But mixing "untitled" in project definition with "appuntitled" everywhere else won't work for sure.
Best practice is to use ${PROJECT_NAME} variable :
project (somename blablabla) qt_add_executable (${PROJECT_NAME} yourfiles) qt_add_qml_module (${PROJECT_NAME} URI your.project.uri RESOURCE_PREFIX someprefix VERSION 1.0 QML_FILES YourQmlFiles.qml )
it's more reliable template than QtCreator's defaults.
@ankou29666
here are the error details
-
-
made a try with 6.8.3 on mac, the default template makes project untitled and everywhere else is appuntitled. builds fine, fine. (just complaining that virtual keyboard is not installed, I don't really understand why but doesn't matter). So yeah looks like the name given in project doesn't have to match the name given in qt_add_executable.