Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-117908

mocinclude.opt problem building on Windows using cmd line.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 6.4.3, 6.5.3
    • Build tools: qmake
    • None
    • Windows

    Description

      Hi,

      I'm trying to move all my builds from using Visual Studio to building with CMD line scripts and MSBUILD. For some projects, everything is fine. For bigger projects, the MOC step gives the error

      moc: Cannot open options file specified with a @

      I generate the Visual Studio project using

        set PATH=%PATH%;C:\Qt\6.5.3\msvc2019_64\bin

        qmake -tp vc FIRdesignerM.pro

      and the resulting vcxproj file opens and compiles fine in Visual Studio 2022, but when compiling the vcxproj at the command line using

        msbuild /property:Configuration=Release

      the UI files MOC ok, but when it gets to the header files, MOC reports

        moc: Cannot open options file specified with a @

      For these files, the vcxproj file has 

      C:\Qt\6.5.3\msvc2019_64\bin\moc.exe  -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DAPP_VERSION="4.0.10" -DV_SPACING_1=5 -DV_SPACING_2=5 -D_WINDOWS_ASIO_ -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DNDEBUG -DQT_NO_DEBUG -DQT_WEBENGINEWIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_WEBENGINECORE_LIB -DQT_QUICK_LIB -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_QMLINTEGRATION_LIB -DQT_POSITIONING_LIB -DQT_CORE5COMPAT_LIB -DQT_CORE_LIB --compiler-flavor=msvc --include C:/code_p4_home/FIRdesignerM_2/Release4.0.10/release/moc_predefs.h @release/mocinclude.opt audio\audiocontrol.h -o release\moc_audiocontrol.cpp

      What I've found is that mocinclude.opt is in the project directly, but is not in the 'release' subdirectory. So when scripting the build, I have to copy mocinclude.opt into release\mocinclude.opt before running MSBUILD.

      Like I said, this problem doesn't show up when compiling the vcxproj file using visual studio,

      One solution I suggest is that the qmake step should create the release directory and copy the mocinclude.opt file into it; ready for when the build starts. Alternatively, have qmake set the locations (in the vcxproj) to use the project directory, and NOT release or debug subdirectories.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtbuildsystem Qt Build System Team
            mjsmithers Michael Smithers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes