summaryrefslogtreecommitdiffstats
path: root/cmake/QtInternalTargets.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Add --enable-new-dtags flag supportAlexey Edelev2020-12-221-0/+4
| | | | | | | | | | | | | | Remove enable-new-dtags from feature mapping, handle it as regular feature. Regenerate configure.cmake with 'enable-new-dtags' enabled. Check for enable_new_dtags feature, add -Wl,--enable-new-dtags if enabled. Fixes: QTBUG-89013 Change-Id: Ice57c02dc85f7f9ecf14e3bc65f31a57b589ce24 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> (cherry picked from commit bbebfa0be2e51b638459d6d812e4db25a65a0d6d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* MSVC: enable identical COMDAT folding for release buildsYuhang Zhao2020-11-121-1/+1
| | | | | | | | | | | | | | | According to Microsoft's docs, /OPT:ICF is enabled by the linker by default unless /OPT:NOICF or /DEBUG is specified. If we are in RelWithDebInfo mode, /DEBUG is passed to the linker to generate debug symbols, however, it caused the identical COMDAT folding be disabled. We now pass /OPT:ICF to the linker explicitly to prevent this. [1] https://docs.microsoft.com/en-us/cpp/build/reference/opt-optimizations?view=msvc-160 Change-Id: I02099edb81034ace7bb19f1164d57829e3979a5f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: don't add the same parameter twiceYuhang Zhao2020-11-041-9/+1
| | | | | Change-Id: Ic5001f296b56f1181f5e37718e090f931eca8b50 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Always add -Wno-ignored-attributes for clang targeting windowsMartin Storsjö2020-11-041-6/+7
| | | | | | | | | | | This matches how it is in the qmake mkspec, silencing a lot of warnings - but contrary to when building with qmake, it's only applied when building Qt itself. For external projects built with cmake, the Qt headers are included with -isystem, which silences any warnings from those headers. Change-Id: I1a498d3c2715cb73e647668cb7226ceeffb7ff0b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Set a warning flag based on the target arch, not build hostMartin Storsjö2020-11-031-1/+1
| | | | | Change-Id: I0b524d52286210b7782dd710467fbc3a742d0c08 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve clang-cl support for Qt6Yuhang Zhao2020-11-021-3/+7
| | | | | | | | | | 1. clang-cl doesn't support "-fno-exceptions", it uses msvc's parameter. 2. some parameters supported by msvc are not supported by clang-cl and they are causing huge warning message flood, don't add them. 3. use correct optimize parameter for clang-cl. Change-Id: Idbadf139127143c5fa6c49068588cb26f47da7a2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add externConstexpr to MSVC compile optionsUlf Hermann2020-10-131-0/+5
| | | | | | | | We want this in order to be able to export constexpr members. Change-Id: I33ba7964ebee54fe656df983985d8d6fa0b99358 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Fix build with Clang on WindowsKai Koehne2020-09-111-0/+6
| | | | | | | | | | | win32-clang-g++/qmake.conf did define QMAKE_CFLAGS_WARN_ON += -Wextra -Wno-ignored-attributes probably for the same reason. Change-Id: I14b66f2555949c03a2ea996923e31f5ec9f7105a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -force-assertsJoerg Bornemann2020-08-271-0/+4
| | | | | Change-Id: Ife15b8d008c5b3f5eed61ec3bc048fda4c4b4e46 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -gdb-indexJoerg Bornemann2020-08-231-0/+4
| | | | | Change-Id: Iea0fb99297751b1baf830a416ea5041d0b9a3b63 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -linker [bfd,gold,lld]Joerg Bornemann2020-08-201-0/+8
| | | | | | Fixes: QTBUG-86155 Change-Id: I5ba2d3b52d9ca240b48904c492f7902a056c0292 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add /OPT:REF flag when building Qt on WindowsAlexandru Croitor2020-08-191-0/+7
| | | | | | | | | | | | In qmake it's done for all qmake projects, in CMake we lean on the safe side and apply it to building Qt itself. User CMake projects can then choose to add it themselves. Task-number: QTBUG-85992 Change-Id: I51919f947d43ffd9925e3d2837dcad17e480367d Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Handle -D, -I, -F and -L configure argumentsJoerg Bornemann2020-08-171-0/+19
| | | | | | | | | | | | | | Introduce new CMake variables and map -D to QT_EXTRA_DEFINES, -I to QT_EXTRA_INCLUDEPATHS, -L to QT_EXTRA_LIBDIRS, and -F to QT_EXTRA_FRAMEWORKPATHS. Those variables only affect the Qt build, not user projects. Fixes: QTBUG-85878 Change-Id: I229df2eed1505a2619068d0d32975962b052569a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't use lld linker for Android with a Windows hostAlexandru Croitor2020-08-061-1/+4
| | | | | | | | | | | | Most of the time lld just gets stuck (deadlock) waiting on some mutex, thus failing integrations. Amends 64c111e10fcb2f69855432177d76649b6b789fac Task-number: QTBUG-85911 Change-Id: Id73bf967a7aeb0e0cbccfaafe056b325c8711f82 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Introduce qt_internal_add_appAlexandru Croitor2020-07-311-2/+6
| | | | | | | | | | | | | | | This new function is meant to be used where load(qt_app) is used. It delegates functionality to qt_add_executable, while handling some additional behavior via a finalization function (mostly handling of macOS Info.plist files and icons, as well as Windows icons and resource files) It uses a new PlatformAppInternal interface target. Task-number: QTBUG-85757 Change-Id: I1a2d5851b137fcd4a6323e0e06fb154f91619800 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Add -Wsuggest-override for gcc >= 9.2Alexander Volkov2020-07-241-0/+4
| | | | | | | | | gcc doesn't report warnings for final methods since version 9.2: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010 Change-Id: I7152351aac0e3bad86d777e119f25137ef97ec6f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Limit OpenGL deprecation silencing on Apple platform to Qt itselfTor Arne Vestbø2020-07-021-0/+10
| | | | | | | | | | | | | | | | | | | | | Apple deprecated the entire OpenGL API in favor of Metal, which we are aware of, so we don't need to see the warnings when building Qt. Instead of applying the silencing globally for all Qt consumers, both internal and external, we now limit the silencing to Qt itself. That means user code that explicitly uses any of the deprecated APIs will see the warnings. Note that this does not apply to merely using any of the Qt OpenGL APIs. The user has to explicitly use the platform APIs that have been deprecated. The warnings need to be disabled on a build system level, so that that they are passed as -D flags on the command line. If the defines were done in Qt headers (qguiglobal.h e.g.), they would require the user to always include this header before any of the Apple headers. Change-Id: I3f2a2a5211332a059ad4416394251772c677fdcb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Enable bitcode when targeting UIKIT aka iOSAlexandru Croitor2020-07-011-0/+16
| | | | | | | | | | | | | | | | | Building an iOS app with qmake failed because Qt itself was not built with bitcode enabled. Enable building with bitcode. Make sure qrc resource files and bundled 3rd party libraries also build with the regular Qt module flags and thus with bitcode enabled. As a consequence gc_sections has to be disabled for UIKIT platforms. Task-number: QTBUG-82581 Task-number: QTBUG-84781 Task-number: QTBUG-85240 Change-Id: I15fe668725a139c02f2a32a5db849b46d4ce325c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Make GL_SILENCE_DEPRECATION a public define for all consumersAlexandru Croitor2020-06-121-6/+0
| | | | | | | | | | | | In qmake land the define is set in mkspecs/common/macx.conf which means it should be public for all Qt consumer apps as well, not just internal targets. Make it so. Amends 17be43c58ec6fbffee52d2a64038c4744610875a Task-number: QTBUG-83929 Change-Id: I9f9d7dfca24b54977cb8364723c3618d3fec2e73 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Propagate largefile flags to all internal consumersAlexandru Croitor2020-06-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The large file flags in qmake land are set in the mkspecs/features/unix/largefile.prf file, which is loaded by qmake when a CONFIG += largefile entry is written by configure into qmodule.pri. This essentially makes them global flags for all private Qt targets because qmodule.pri is a global file loaded load(qt_build_config) Thus assign the flags onto the PlatformCommonInternal target instead of the PlatformModuleInternal one. One peculiarity though is that in qmake land these flags are also applied when building examples as part of the main Qt build. This is because qt_build_config loads qmodule.pri even for an example, because qmake sees it as part of the overall Qt build. The flags are not applied by qmake if the example is built in a different standalone build dir not part of the Qt buil dir. We don't do that in the CMake build, and thus examples will never have those flags. Task-number: QTBUG-83929 Change-Id: If653a669b4835aadd1de84acb477c375ab523909 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Use -fapplication-extension when building Qt libraries on macOSAlexandru Croitor2020-05-281-0/+19
| | | | | | | | | | | | | | | | | Needed to avoid linker warnings transformed into errors, when linking QtWebEngine with qmake mixing. ld: warning: linking against a dylib which is not safe for use in application extensions: The flag is added to libraries and plugins, unless opted out. CMake equivalent of 944110089d4cb1c229dba422989e154db65a67fd Task-number: QTBUG-83929 Task-number: QTBUG-75666 Change-Id: I3e9acca4712c9a266bf54c6e35e2fd2c0096692b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Enable default usage of utf8 sources for Qt consumersAlexandru Croitor2020-05-151-1/+1
| | | | | | | | | | And enable the same default when building Qt itself (it's implicit). Allow opting out on a target-by-target basis, by using the public qt_disable_utf8_sources() API call. Change-Id: Ifc19a744d57b96b1c74a6926a0c6628c2a820464 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Limit warnings_are_errors flags to C++ and Objective-C++Alexandru Croitor2020-05-011-2/+9
| | | | | | | | Otherwise when applied to bundled 3rd party library C files, the MinGW build fails when compiling src/3rdparty/md4c/md4c.c. Change-Id: Ia522b10aa69aa15f239d20c65e31c84edbccee6d Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* CMake: Fix 32 bit Qt builds like our MinGW config in CoinAlexandru Croitor2020-05-011-0/+49
| | | | | | | | | | | | | | Enable sse2 and fpmath for modules when appropriate, the logic is a port of the code in mkspecs/features/qt_module.prf. Fix qdrawhelper.cpp to always be compiled when using GCC with a special case. pro2cmake.py failed to handle the source subtraction correctly. Fixes: QTBUG-83791 Task-number: QTBUG-75578 Change-Id: Ibe32a250b266d580ad21f6c55f09fd03a14ceb82 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* CMake: Fix build with WARNINGS_ARE_ERRORS=ON and gcc 9.3.0Joerg Bornemann2020-04-061-0/+2
| | | | | | | | | Add -Wno-error=format-overflow. This is similar to what is done in qt_common.prf, however we don't turn the warning off completely. For now at least. Change-Id: I93c20064759dea43309c3a17de4d733ede9ca2cb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Remove APPLE prefix from platform namesTor Arne Vestbø2020-03-161-3/+3
| | | | | | | None of the other platforms have it. Change-Id: Ib448c2c03ba03f711b507ef391977c0e6aa7c192 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Fix naming when referring to Apple macOSTor Arne Vestbø2020-03-161-1/+1
| | | | | Change-Id: Iafb5e448d0d65d42f788464fc600594a5666f9af Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Disable GL deprecations on Apple platformsTor Arne Vestbø2020-03-121-0/+6
| | | | | Change-Id: I87b98ae68d996868cefaaf578722ac24be745145 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add missing linker flags for MSVCLeander Beernaert2020-02-251-0/+6
| | | | | | | | This patch adds missing linker flags for MSVC in order to match qmake's msvc-desktop.conf. Change-Id: Ieb1206dae4517e8d9f36175f8fcebccd30e52d01 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add missing compile flags for msvcLeander Beernaert2020-02-201-0/+24
| | | | | | | | | This patch adds a couple of missing compile flags that are defined in mkspecs/common/msvc-version.conf and mkspecs/common/msvc-desktop.conf that were not yet ported to CMake. Change-Id: I9ef0ef71cb0c063699fba4c067e90f6515169baf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix use of compile define QT_NO_DEBUGLeander Beernaert2020-02-201-3/+1
| | | | | | | | | | | | Prior to this patch QT_NO_DEBUG would not be correctly set for generators which support multiple configurations such as Visual Studio and XCode. This patch also applies the define to all executables, which was previously missing. Change-Id: I16a911d15217a62093c68ba2b4c2545cdb8df1e6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add initial support for cross-building to iOSAlexandru Croitor2019-12-031-0/+12
| | | | | | | | | | | | | | | | | | | | | | Tested locally with the following configurations: - iOS device builds (arm64) - iOS simulator builds (x86_64) - iOS simulator_and_device builds (fat arm64 and x86_64 archives) All iOS builds currently require a custom vcpkg fork which contains fixes for building the required 3rd party libraries. qtsvg, qtdeclarative, qtgraphicaleffects and qtquickcontrols2 have also been tested to build successfully. simulator_and_device builds are also supported, but require an umerged patch in upstream CMake as well as further patches to vcpkg. Task-number: QTBUG-75576 Change-Id: Icd29913fbbd52a60e07ea5253fd9c7af7f8ce44c Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Qt CMake Build Bot Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* Add support for skipping warnings are errorsAlexandru Croitor2019-11-121-9/+13
| | | | | | | | | | | | | | | | | | | Unfortunately not all repositories are marked as warning_clean in their .qmake.conf files. For instance qtconnectivity and qttools are not warning clean. Therefore we need to skip warnings_are_errors flags on all targets created in that repository. Add support for skipping the warnings are errors flags, by setting a QT_SKIP_WARNINGS_ARE_ERRORS property on a target, and use that within a generator expression with all the accumulated flags. To mimic behavior of qmake, and set the property on all targets created by add_qt_module, add_qt_plugin, etc, one simply needs to set the QT_REPO_NOT_WARNINGS_CLEAN variable in the repo project CMakeLists.txt. Change-Id: Ib5a487af6601ae1519a0988a89f8083f94f92267 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Check for the correct apple clang version with warnings_are_errorsAlexandru Croitor2019-06-241-1/+1
| | | | | | | | | | The current state of qtbase is confirmed to be built with no warnings when using up to Xcode 9.2, as per the check in mkspecs/features/qt_common.prf. Add the same check for the CMake build. Change-Id: I0c2409ece048e93fba29c41a8bd053dd112949bd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add PlatformCommonInternal target and QT_NO_DEBUG definitionAlexandru Croitor2019-06-241-0/+10
| | | | | | | | | | | | | | All the other PlatformModuleInternal, PlatformPluginInternal, PlatformToolInternal target will depend on the common one. Also add the QT_NO_DEBUG definition when the build type is not Debug. This fixes the lookup of the Qt platform plugin on macOS, which uses a "_debug" prefix in the plugin name depending on if the QT_NO_DEBUG definition is present or not. This is the same as it is done in mkspecs/features/qt.prf. Change-Id: I82cf461d44b8a3b3c5dc2b2d9f25baa246fc1e4b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add appropriate MSVC version check for warnings are errors featureAlexandru Croitor2019-06-111-2/+6
| | | | | | | | | | In qmake land warnings_are_errors is only enabled for specific MSVC versions, ending with MSVC2015. Presumably the warnings have not yet been fixed for newer MSVC versions, so we stick with the same status quo for now. Change-Id: Idc3741d39c888f77ed324a5eb8c654416591785f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't add _LARGEFILE64_SOURCE define on WindowsAlexandru Croitor2019-06-111-2/+3
| | | | | | | | | | | | | | In qmake land, the largefile.prf feature is automatically loaded due to 'largefile' being added to CONFIG via the equivalent feature. The prf file is in the 'unix' subfolder though, which means that qmake doesn't load it on Windows. We need to do the same, otherwise we get build errors due to the define being checked in ZLIB headers, and selecting an invalid code branch on Windows. Change-Id: Ibe9202a639754927262bb8aaa28289934f2e23ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify per-module option handlingSimon Hausmann2019-06-061-0/+14
| | | | | | | | Move flags/options that we use for modules from add_module to the new platform module target. Change-Id: I89e414690336dcd37253432fe5116226d1c8dd82 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Introduce Platform*Internal targetsAlbert Astals Cid2019-06-051-0/+69
Link to them from add_qt_module/plugin/tool This way we set the warnings_are_errors flags just once and also non-qtbase modules get them Change-Id: I2b65a81694aaebdd7c886249f217c11f79492bad Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>