Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved How to use precompiled headers in CMake project in QtCreator?

    Tools
    cmake code model qtcreator precompile
    2
    2
    908
    Loading More Posts
    • 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
      Alexander Trots last edited by Alexander Trots

      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 Reply Quote 0
      • _
        _Rayman_ last edited by

        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 Reply Quote 0
        • First post
          Last post