Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,103
    • Issues 4,103
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #18353
Closed
Open
Issue created Sep 10, 2018 by Floofy-KH@Floofy-KH

Qt's moc not running when using cotire, Visual Studio, and CMake 3.12.x.x

CotireMOCBug.zip

Encountered an issue while using building a CMake project that uses Cotire (https://github.com/sakra/cotire/) for pre-compiled headers, and Qt5's Meta-Object Compiler (moc), using Visual Studio as a generator, and CMake 3.12.x. The issue is that moc is not run at all, which causes a build failure because the source files that moc should generate do not exist when Visual Studio tries to compile.

I've attached a minimal project which demonstrates this behaviour.

To generate a build that will fail:

  1. Use CMake 3.12.0 or greater
  2. Use Visual Studio as a generator (I use Visual Studio 15 2017 Win64)
  3. Have Qt5 installed (I use Qt5.9.2)
  4. You will need to tell CMake where to find Qt5, I set CMAKE_PREFIX_PATH to the installation of Qt.
  5. Open the generated solution and build. You should get an error along the lines of "Cannot open source file: 'C:\builds\cotire_bug_cmake3_12_0\main\moc_qobject_file.cpp': No such file or directory"

Following the above steps but with CMake 3.11.x will build successfully.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking