Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

CMake: Resource object for reading: Unknown error in using qt5_add_big_resources()



  • I have been studying Qt build with CMake and would like to adopt it for my project requiring "CONFIG += resources_big" in the .pro.

    To replace the resource_big, I found qt5_add_big_resources(), then tried using it in a minimal project.

    However, I faced the following error. Are there any ideas to solve this problem or any workarounds?

    D:\project\product\exercises\qt_cmake\hello\build>cmake --build .
    Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.
    
      Automatic MOC for target rcc_object_qml
      rcc_object_qml.vcxproj -> D:\project\product\exercises\qt_cmake\hello\build\r
      cc_object_qml.dir\Debug\rcc_object_qml.lib
      Automatic MOC for target hello
      Generating qrc_qml.o
      Unable to open temporary file D:/project/product/exercises/qt_cmake/hello/bui
      ld/qrc_qml.o for reading: Unknown error
    
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VC
    Targets\Microsoft.CppCommon.targets(209,5): error MSB6006: "cmd.exe" exited wit
    h code 1. [D:\project\product\exercises\qt_cmake\hello\build\hello.vcxproj]
    

    // FYI - project working directory - D:\project\product\exercises\qt_cmake

    <Note>

    • qt5_add_resources was working fine on the same environment.
    • Here is my CMakeLists.txt of the minimal project - "hello". This was derived from Qt new Cmake project template "Qt Quick Application - Empty" and minor changes were incorporated there.
    cmake_minimum_required(VERSION 3.13.0)
    project(hello LANGUAGES CXX VERSION 0.0.1)
    
    # Declare
    if("$ENV{QTDIR}" STRGREATER "" OR DEFINED QTDIR)
      message(STATUS "Qt ENV found")
      set(QTDIR $ENV{QTDIR})
    else()
      set(QTDIR "C:\\Qt\\5.12.3\\msvc2017")
      message(STATUS "ENV{QTDIR} not found instead set \"${QTDIR}\"")
    endif()
    
    set(CMAKE_PREFIX_PATH ${QTDIR})
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    set(CMAKE_CXX_STANDARD 11)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    # Qt
    find_package(Qt5 COMPONENTS Core Quick REQUIRED)
    
    # Executables
    set(SOURCES main.cpp)
    # qt5_add_resources(SOURCES qml.qrc) # No problems.
    qt5_add_big_resources(SOURCES qml.qrc)
    add_executable(${PROJECT_NAME} WIN32 ${SOURCES})
    
    target_compile_definitions(
      ${PROJECT_NAME} PRIVATE
      $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
    target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick)
    

    <Environment>

    • Windows 7 Professional
    • Qt - 5.12.3 (msvc2017)
    • CMake - 3.14.5


  • Hi, the latest 5.13.0 seems to fix up this issue. So closed.


Log in to reply