How to build statically with Qt 5.12.11?
Thanks for the awesome project dantti. Do you happen to know how to build the libraries statically with Qt 5.12.11 (the main relevant part being Qt 5)? I only have QMake.exe to work with in the qt static build dir. I have scoured the web looking for solutions but haven't been able to find anything that works yet. I can build my program statically but as it is now it depends on Qt5Core.dll and Qt5Network.dll when using the simple-mail library. Ideally I would like a static build without dlls. Thanks again!
https://github.com/cutelyst/simple-mail/blob/master/CMakeLists.txt#L21
Awesome thanks for the quick reply, will try.
Still no luck, tried 4 separate builds one with Qt Creator using 5.15.2 and another using Qt Creator with 5.12.11. My static build is from 5.12.11. I both edited the CMakeLists.txt file as recommended and setting BUILD_SHARED_LIBS to off in the CMake configuration section of build settings for the project. Obviously after building the library I compiled my program statically. It's still asking for both SimpleMail2Qt5.dll and when that's present Qt5Core.dll and Qt5Network.dll. There's gotta be something simple I'm overlooking, any ideas? Should I try building outside of Qt Creator? Thanks for the help!
you should not edit the cmake file, instead tell cmake the option, QtCreator lists all of them
Still no luck, unmodified CMakeLists.txt and told Qt Creator to turn off BUILD_SHARED_LIBS. The static .lib file should be bigger than the shared .lib file right? I built it 5 times same size each time and my silly program is still barking at me. Either I'm cursed and in need of an exorcism or I'm a babbling idiot who can't figure this out :) Any ideas? On my laptop with Qt Creator & 5.12.11 Cmake didn't come bundled with the Qt install so I've been using MSVS Cmake for it on the laptop. Also on my desktop with Qt Creator & 5.15.2 Cmake came bundled so I've been using the bundled one but still get the same problems.
Another caveat ... the laptop has MSVS 2019 installed but Qt 5.12.11 uses MSVS 2017... shouldn't matter right?
Sorry I'm no Windows expert, regarding the compiler it could be an issue the other way around.
I actually just built from the command-line with -DBUILD_SHARED_LIBS=OFF then built the library using MSVS and it's the exact same size for both the dll and the lib file as before. I assume it should be bigger when including the Qt code for a static library right? I might seek help on stack overflow. Thanks!
No building simple-mail in static mode builds simple-mail in static mode. To include Qt you would need to build Qt in static mode.
Actually even with Qt in static mode it would not be included in simple-mail static libs, only on simple-mail demos (if built)
As it is now the statically built program runs fine without any dlls unless I include the simplemail library, then it asks for SimpleMail2Qt5.dll and if that's there then it asks for Qt5Core.dll and Qt5Network.dll. Not sure how the compilation works for that.
- unless I include the simplemail library and email code in the program *
Any complications with setting up cutelyst simplemail as a pri project?
Finally figured this guy out, see here.
Fixed by https://github.com/cutelyst/simple-mail/commit/759d40e5ee713be76b5c272019b52605dcd46897