Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to use precompiled headers in CMake project in QtCreator?

How to use precompiled headers in CMake project in QtCreator?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
cmakecode modelqtcreatorprecompile
2 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alexander Trots
    wrote on 20 Mar 2019, 08:24 last edited by Alexander Trots
    #1

    Hello
    I trying to use a precompiled header in CMake project. Cotire module provides this functionality. But QtCreator code highlight not working. It seems that QtCreator code model doesn't parse a precompiled header.
    Here is a project example:

    CMakeLists.txt

    include(cotire)
    
    cmake_minimum_required(VERSION 2.8)
    
    project(temp_cmake_precompiled)
    add_executable(${PROJECT_NAME} "main.cpp")
    
    set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "Stable.h")
    cotire(${PROJECT_NAME})
    

    main.cpp

    int main()
    {
      std::vector<int> vec;
      std::cout << vec.size() << std::endl;
      return 0;
    }
    
    

    Stable.h

    #include <iostream>
    #include <vector>
    

    Both Clang and built-in code model have this problem. But build performs with success.
    In dialog Tools -> C++ -> Inspect C++ Code Model... a Precompiled headers key is set to <None>.

    May be there is a different way to specify a precompiled header in CMake project that QtCreator can resolve?

    QtCreator 4.8.2

    1 Reply Last reply
    0
    • _ Offline
      _ Offline
      _Rayman_
      wrote on 1 Sept 2019, 21:08 last edited by
      #2

      I ran into the same problem and this problem is very very annoying during daily work.

      I filed a bug report for that issue.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved