Important: Please read the Qt Code of Conduct -

Qt 5.12.4 TextToSpeech with CMake

  • Hi all,

    I am new to CMake and I want to build a CMake based project using TextToSpeech. This project was done with an old version of Qt (5.8).

    In Qt 5.8, the TextToSpeech engine was an external module, so to use it, in the CMakeLists.txt was:


    But with Qt 5.12.4, the TTS Engine is part of the Core Lib, and CMake ends with an error:

    CMake Error at CMakeLists.txt:84 (add_executable):
    Target "TtsExample" links to target "Qt5::TextToSpeech" but the target was
    not found. Perhaps a find_package() call is missing for an IMPORTED
    target, or an ALIAS target is missing?

    Enable TextToSpeech with QMake is easy, I only have to add QT += texttoseech in the PRO file.
    But how do I have to change my CMakeLists.txt to do the same with CMake?

    I am using:

    • Qt 5.12.4 for Windows 32 bits (MSVC 2017)
    • CMake 3.15.2 32 bits
    • Qt Creator 4.10 rc1

    Thanks for any help or pointer, I've searched on Qt documentation, but didn't find how to do it.

  • @kromignon I reply to my self... After restarting Qt Creator, opening the CMake project works also with Qt 5.12.4...
    Don't understand why?

    It seems to me that CMake is not very stable!

  • Lifetime Qt Champion

    CMake integration into Creator is very basic and we also had many issues with it not parsing the project file the first time.
    However it got a bit better with never Creators.

Log in to reply