Go to file
Tor Arne Vestbø 525372c567 cmake: Ensure Mingw builds pick up and use the WinMain entry point
The cmake code path didn't export QT_NEEDS_QMAIN as a public define
to be inherited by consumers. As a result, the users's main() would
be defined as normal (instead of being named qMain). This in turn
would lead mingw to pick main() as the entrypoint during link time.

We want to go through our WinMain entrypoint (for now), even if
MingGW today has mechanisms for calling the user's main() directly,
as our WinMain uses GetCommandLineW() and as a result prevents
the arguments to main() from being wildcard expanded. and we
want to keep parity between qmake and CMake in how this behaves,
even if we end up changing it in the future.

We follow what qmake does, and expose QT_NEEDS_QMAIN to clients.
With the user's main being then named qMain, mingw will look for
our WinMain.

This in turn leads to the problem of static link ordering, where
adding -lmingw32 as a dependency of the static library target
results in it ending up _after_ the static library during link
time, and the static linker ends up discarding the entry point
library.

To solve this, we split the entry point module into two targets,
one for consumers, and one internal that is the actual static
library. By adding the -lmingw32 dependency to the former target,
we ensure it's added before the static library during linking.

Change-Id: I342c979f56669d5a5a5c237f476556c4e2baf432
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-26 20:10:48 +01:00
.github/workflows GitHub Actions: Fix workflow file 2020-09-11 13:37:48 +02:00
bin CMake: Provide a qt-internal-configure-tests script 2020-10-26 15:23:25 +01:00
cmake cmake: Allow target to specify initial module internal config 2020-10-26 20:10:48 +01:00
coin CMake: Provide a qt-internal-configure-tests script 2020-10-26 15:23:25 +01:00
config.tests CMake: Skip regeneration of manual compile test project 2020-04-09 11:26:46 +02:00
dist Remove last remainings of Qt Quick 1 imports 2020-05-25 11:48:12 +02:00
doc CMake: Allow docs generation without installing in top-level builds 2020-10-23 11:36:48 +02:00
examples CMake: Regenerate examples to use qt_add_executable 2020-10-19 11:51:47 +02:00
lib
mkspecs qmake: Don't warn about using private headers if there are none 2020-10-23 20:19:29 +02:00
qmake Make "qmake -qtconf my-qt.conf -install ..." possible 2020-10-23 21:11:50 +02:00
src cmake: Ensure Mingw builds pick up and use the WinMain entry point 2020-10-26 20:10:48 +01:00
tests Add constructor benchmarks for QLocale, to test likely sub-tag matching 2020-10-26 15:56:06 +02:00
util Update CLDR to v37, adding Nigerian Pidgin as a new language 2020-10-26 15:28:59 +02:00
.cmake.conf pro2cmake.py: Generate .cmake.conf files for versioning 2020-04-30 17:44:03 +00:00
.gitattributes
.gitignore .gitignore: Qt Creator files cleanup 2020-09-25 07:50:15 +02:00
.lgtm.yml Skip LGTM analysis for the bootstrap library and tools 2020-07-16 01:04:34 +02:00
.prev_configure.cmake CMake: Introduce CMake-only optimize_full feature 2020-10-06 10:07:08 +02:00
.prev_qt_cmdline.cmake CMake: Regenerate configure.cmake files 2020-09-28 15:48:17 +02:00
.qmake.conf Bump version 2020-02-02 13:41:14 +01:00
.tag
CMakeLists.txt CMake: Fix building examples targeting iOS simulator with qmake 2020-10-16 13:53:04 +02:00
config_help.txt CMake Build: Add support for -qtlibinfix configure parameter 2020-09-23 17:31:13 +02:00
configure configure: add -qmake argument 2020-10-01 14:34:05 +02:00
configure.bat configure: add -qmake argument 2020-10-01 14:34:05 +02:00
configure.cmake CMake: Allow Debug-only iOS builds 2020-10-16 13:53:03 +02:00
configure.json By default don't try to use pkg-config when targeting Android 2020-09-28 15:48:17 +02:00
configure.pri Android: allow setting javac build version from the configure script 2020-09-16 20:55:08 +03:00
dependencies.yaml Re-add dependencies.yaml so repos outside qt5 can be built with Coin 2019-09-19 17:07:36 +00:00
INSTALL INSTALL: Remove outdated reference to Windows CE 2019-02-13 13:01:57 +00:00
LICENSE.FDL
LICENSE.GPL2 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3-EXCEPT Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.LGPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.LGPLv3 Remove LICENSE.GPLv3, LICENSE.LGPLv21, LGPL_EXCEPTION.txt 2018-04-16 11:02:14 +00:00
LICENSE.QT-LICENSE-AGREEMENT Update enterprise license agreement v4.2.1 2019-12-18 13:07:19 +02:00
qt_cmdline.cmake CMake: Fix the -sanitize configure option 2020-10-12 13:57:56 +02:00
qtbase.pro Update qmake before building src 2020-08-19 18:25:51 +02:00
sync.profile Export gbm device integration to build it outside 2020-10-23 16:46:02 +09:00