Qt6 QSerialPort qmake vs cmake
-
Hello,
I am running on Qt 6:
Qt Creator 7.0.1
Based on Qt 6.2.3 (MSVC 2019, 64 bit)
Built on Apr 26 2022 01:23:20I can open and run the QSerialPort async reader and writer examples with no issues. I'm now trying to adapt the code to my own purposes and have started a CMake project (MSCV2019). I copy/pasted the code from the reader example and am trying to run it verbatim in my project. When I do it fails with 'LNK2019: unresolved external symbol' errors (8 of them), all related to QSerialPort methods.
I'm assuming that I haven't set something up correctly in my overall build but as a beginner with CMake/MSCV I'm not sure how to figure it out. Besides the CMakeLists.txt vs .pro difference, I noticed that I had to change the #include <QSerialPort> in the example file to #include <QtSerialPort/QSerialPort> for it to be found (I added 'SerialPort' to my CMakeLists.txt REQUIRED COMPONENTS already).
Any pointers on figuring this out are appreciated - I know I'm in a learning curve right now...
-
Hi
also
target_link_libraries(mytarget PRIVATE Qt6::SerialPort)
? -
@MScottM
Hi
Super :)
Please note (since learning)
that the docs can be used to know such things