Possible to link without qmake or other tools? [Edited] [Mostly Solved]
-
Hey there folks. I'm attempting to create a project in Visual Studio 2013 that can dynamically link to Qt. I'm using CMake to generate my project, but for various reasons it's not ideal for me to have an installed copy of Qt to depend on. So in my repository I have all the Dlls from the installed copy in a path like this: "Dependencies/Qt/library/x64", with all of the folders in the installed copies include directory in a path like this: "/Dependencies/Qt/include"
I'm attempting to compile an executable with the following code as a test:
#include "QtWidgets/QApplication.h" #include "QtWidgets/QLabel.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel *label = new QLabel("Hello Qt!"); label->show(); return app.exec(); }
But unfortunately I get linker errors which are at the bottom of this post.
Now I can't say this was unexpected, but I would like to know how to dynamically link to Qt correctly without relying on its tools to generate my sln or find the library for CMake, if that's at all possible.
Thanks for reading!
[Begin Edit]
I've solved my problem. I wasn't attempting to link with the installed library files. Just to be clear, this is still considered Dynamic linking is it not? So I'd still fall into the Dynamic Linking exception of the LGPL 2.1 correct? -
Hi and welcome to devnet,
CMake has a Qt 5 finder script that you can use, you would only need to add the path where to find Qt 5 when you call cmake and it will handle things for you.