summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* Revert "CMake: Fix usage of find_dependency()"Lars Knoll2020-09-135-36/+53
| | | | | | | | | | This reverts commit 58c1c6ee5c986d502b56eb1cc57f1d9444d42031. This lead to configuration errors on some machines, blocking development. Change-Id: I744f6cc95fbaa273519ab8fc8fb492b87f5729b8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Revert "CMake: Reduce the number of find_dependency calls"Lars Knoll2020-09-133-11/+14
| | | | | | | | | | This reverts commit a3cb002511d7e2cc73234611795c1947620aedd5. This lead to configuration errors on some machines, blocking development. Change-Id: Ibb785c96c7d85692a6e22a73e086119eb571df71 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Revert "CMake: Add facility to mark package dependencies as optional"Lars Knoll2020-09-135-44/+17
| | | | | | | | | | This reverts commit 3685483c4b79b4075bab6d341174a395359d1b4a. This lead to configuration errors on some machines, blocking development. Change-Id: I309cdd55a8ef64899afcbeca54458d1c6d686951 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Add facility to mark package dependencies as optionalJoerg Bornemann2020-09-125-17/+44
| | | | | | | | | | | | | | | | Every public dependency of a Qt module results in a find_package call in the consuming project. But not all public dependencies are mandatory. For example, vulkan is only needed if the user project actually uses Qt classes that pull in vulkan headers. This patch adds the option MARK_OPTIONAL to qt_find_package. Dependencies that are marked as optional will not produce an error on find failure. Task-number: QTBUG-86421 Change-Id: Ia767e7f36991e236582c7509cbd37ea3487bb695 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Reduce the number of find_dependency callsJoerg Bornemann2020-09-123-14/+11
| | | | | | | | | | ...in code. The actual number of calls at runtime does not change. The reason for this stunt is that we want to replace find_dependency with find_package at runtime for optional dependencies, and this will reduce the diff size of the next commit. Change-Id: I304fdf09c69fea7b6d4adabf515712eb097f8c86 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix usage of find_dependency()Joerg Bornemann2020-09-125-53/+36
| | | | | | | | | | | | The find_dependency() macro calls return() on failure, meaning any code after it will be ignored, thus checking any XXX_FOUND variables after find_dependency() is pointless. Fix the places where we use find_dependency() and set the "failed" state before the call and the "success" state afterwards. Change-Id: Ia5239c704f02a9bec972210374ffed7808b14055 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Provide way to register extra tool package dependenciesAlexandru Croitor2020-09-112-2/+50
| | | | | | | | | | | | | | | This is needed for qtwayland, where QtWaylandCompositor package should call find_package(QtWaylandScanner) in the 'Tools' section of the ModuleDependencies.cmake file, rather than the regular 'Qt' section. This takes care of handling host path prefixes, to ensure that a host package is found even when tools have also been cross-compiled via the QT_BUILD_TOOLS_WHEN_CROSSCOMPILING option. Task-number: QTBUG-83968 Change-Id: I4725a630214d053105fb6d2a0f7c5ff6128d13f9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Fix rpaths set for Qt internal apps like DesignerAlexandru Croitor2020-09-112-4/+13
| | | | | | | | | | | | | | | | | qt_apply_rpaths takes into account properties like MACOSX_BUNDLE. This property might not yet be set when qt_internal_add_app is called, but later. To handle that, move the call of qt_apply_rpaths to qt_internal_finalize_app. As a result, the installed apps will have 2 rpaths, the $ORIGIN style relocatable one, and an absolute path one pointing to the Qt prefix/lib. The last one might be unnecessary. Fixes: QTBUG-86514 Change-Id: I25e0d695c78c8b5703e94c99cc2457f772721456 Reviewed-by: Joerg Bornemann <joerg.bornemann@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: Fix qt-configure-module for modules without qt_cmdline.cmakeJoerg Bornemann2020-09-111-2/+4
| | | | | | | | | | Some repos/modules don't have configure.json files and thus no qt_cmdline.cmake files. Make qt-configure-module check for the file's existence. As drive-by fix, surround the configure.cmake's path by double quotes. Change-Id: If1a91a0bba0c2fd282cfa08fa6ff2bb20f0a15ba Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Take MODULE_INCLUDE_NAME into account when installingJoerg Bornemann2020-09-111-8/+9
| | | | | | | | | For modules that have MODULE_INCLUDE_NAME set (for example ActiveQt) we must use this name for the installation rules too. Fixes: QTBUG-86484 Change-Id: I1b97cf534ea5e41655c7b3fdd0330b2f58356a3a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -ltcgJoerg Bornemann2020-09-112-1/+12
| | | | | | | | | | | | | | | | | | | This configure switch sets the CMake variable CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG> per release config to ON. The feature 'ltcg' is enabled if any of the variables CMAKE_INTERPROCEDURAL_OPTIMIZATION, CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG> are ON. In order to implement the check, configurejson2cmake had to be extended to be able to write extra CMake code before and after the feature definition. This extra code can be added to a feature mapping below the keys "cmakePrelude" and "cmakeEpilogue". Task-number: QTBUG-85373 Change-Id: Ia2eb907edcf087f137977a9b090705397f83eb05 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Implement configure -qpaJoerg Bornemann2020-09-112-1/+2
| | | | | Change-Id: I38a938cda91a525d2af22deec864c6a12af3e29d Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Introduce qt-configure-moduleJoerg Bornemann2020-09-111-0/+25
| | | | | | | | | | | | | Add a convenience script to configure a Qt module separately. This script reads and interprets the qt_cmdline.cmake files of the Qt module to be configured and eventually calls qt-cmake-private. Example usage: <install-prefix>/bin/qt-configure-module <source-root>/qtdeclarative -qml-network -- --trace-expand --trace-redirect=cmake.trace Change-Id: I026f1a050cd3f4df740611c32ba8c03161bba7a3 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix markdown syntax in cmake/README.mdJoerg Bornemann2020-09-111-1/+1
| | | | | | | | | Make this file parsable by tools that are less lenient than github. Triple-backquotes are for fenced code blocks. Inline code uses backticks (or double backticks if you have code with backticks). Change-Id: Ic49d946fbcaa6f7e97702eadf4a0b0c726fc3217 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove the -no-compile-examples configure switchJoerg Bornemann2020-09-111-1/+0
| | | | | | | | | | | | If '-make examples -no-compile-examples' was specified, sources of Qt's examples would be installed, but the examples would not be built. This switch has always been a source for confusion and is only interesting for distributors, who can just package the examples directory tree. Change-Id: I0291d70e4951d98b553a4abf217db49d05316d3a Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: Fix generation of XXX_tracepoints.cppJoerg Bornemann2020-09-101-1/+1
| | | | | | | | The include directive was incorrectly written. This amends 5c092c2b401. Change-Id: Ia72ca3a5d5e1486ade4d71a764550d36979640f6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix call to tracegen when cross-compiling toolsJoerg Bornemann2020-09-101-2/+10
| | | | | | | | | | We need to use the imported host tracegen target to generate files, not the one we're going to cross-build. This amends 5c092c2b401. Change-Id: Ib74dd2d87110383c31216872eb55bebf5d90df37 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* CMake: Document more configure argument mappingsJoerg Bornemann2020-09-101-57/+66
| | | | | Change-Id: I4f96fd59566d011088e426342db9cc6536d63a71 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Register qtwaylandscanner dependency when cross-compilingAlexandru Croitor2020-09-101-0/+3
| | | | | | | | | | | | | | qt_record_extra_package_dependency is called by qtwayland to register a dependency between the qtwaylandscanner tool and the waylandscanner tool. When cross-compiling the tools in a Yocto environment, the adjusted target name was not taken into account. Task-number: QTBUG-83968 Change-Id: Ibf7b94876bf29827cf0d9c9bb471f359ef6ff15f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Apply $ORIGIN style rpaths for non-prefix builds as wellAlexandru Croitor2020-09-101-2/+7
| | | | | | | | | | | This works around linking issues when doing yocto non-prefix Qt builds, because CMake does not add -rpath-link flags even though it probably should. Task-number: QTBUG-86533 Change-Id: Iaaf246ac71ca05d9369ceb6eb9c4a1e206c42839 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix qt_apply_rpaths not erroring out when no target is givenAlexandru Croitor2020-09-091-1/+1
| | | | | | | | | I accidentally noticed the message in a CI job, but it didn't fail the build because the FATAL_ERRO was considered as another text token to print, instead of a command keyword. Change-Id: I0e30ebacbed32d1017f9ded681cd6b15cbc32573 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Turn off pkg_config_enabled if pkg_config is not foundAlessandro Portale2020-09-091-7/+28
| | | | | | | | | | | | | | | The qt_build_internals_disable_pkg_config_if_needed function didn't actually check if the pkg-config executable is available when turning the pkg-config feature on. This broke certain configurations like Android (on some hosts). Try to find the executable and take that into account when computing the value of the feature. Task-number: QTBUG-85399 Change-Id: Ie79c637f2d2b689c392862c90075d309906fe506 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix building of non-qtbase repos on Android with Windows hostAlexandru Croitor2020-09-092-3/+5
| | | | | | | | | | | | | | | | The generated toolchain file embedded windows style paths for the android sdk and chainloaded toolchain. This caused CMake does fail at configure time while trying to evaluate backslashes as escape chars. Also syncqt was searched for in libexec, which is not the right directory on Windows. Use the host info package to get the location of the 'libexec'. Task-number: QTBUG-85399 Task-number: QTBUG-85911 Task-number: QTBUG-86053 Change-Id: I1b15ce84496d52c3fda2f65138e1eac43bc95c9e Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Make generated Qt toolchain file a bit more relocatableAlexandru Croitor2020-09-092-7/+15
| | | | | | | | | | | | | | Rather than force setting the apple sysroot and Qt host paths, first check if they are not already defined on the command line and if they aren't, check that the paths with which Qt was configured exist. The goal of the patch is to not set invalid paths, like when using a Qt built in the CI, which will have a different host path / sysroot compared to what a user has locally. Task-number: QTBUG-85240 Change-Id: Ic37566b4fa845d8d1b4e4b5ba7fa4be769e99ca8 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Don't hardcode Xcode SDK frameworks into public dependenciesAlexandru Croitor2020-09-091-25/+44
| | | | | | | | | | | | | | | | | | | | | Using find_library() to find an Xcode framework will end up embedding the absolute path of the framework into INTERFACE_LINK_LIBRARIES. A different machine might not have the SDK installed in the same location, which will cause build failures. This happens in our CI because Xcode is installed to /Applications/Xcode11.app. To fix this, replace all system framework paths with '-framework Foo' flags instead. We already do this for OpenGL and OpenGL ES. In the future we might want to convert these into full standalone FindFoo scripts that expose proper targets. Fixes: QTBUG-86299 Task-number: QTBUG-86422 Task-number: QTBUG-85240 Change-Id: I22b2b2d1d9e92108098d3974105e3758978cd8e2 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: update ARCH_HASWELL flagThiago Macieira2020-09-081-1/+1
| | | | | | | | | We don't support older compilers from before they accepted the architecture codenames. Change-Id: If13a10ed95b34007858bfffd1631a08b425fa9c3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake: add missing RDSEED supportThiago Macieira2020-09-081-0/+5
| | | | | | | | | This was added for Qt 5 in 780137d585344bf9de906a285a50498104c0c66e but apparently the change was never ported over to CMake. Fixes: QTBUG-86452 Change-Id: If13a10ed95b34007858bfffd1631a084370a3232 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove /INCREMENTAL:YES from linker flagsMarcel Krems2020-09-051-2/+0
| | | | | | | | | This flag doesn't exist in MSVC 2015+: LINK : warning LNK4224: /INCREMENTAL:YES is no longer supported; ignored https://docs.microsoft.com/en-us/cpp/build/reference/incremental-link-incrementally?view=vs-2015 Change-Id: I3b2aace619351e2dc9cc86e1df28facc21b7d9fe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Teach QtProcessConfigureArgs.cmake to configure other modulesJoerg Bornemann2020-09-021-12/+18
| | | | | | | | | | | | | | | | | | | | Until now, QtProcessConfigureArgs.cmake could only handle qtbase and the top-level build. Add the variable MODULE_ROOT that the user can point to the module that is to be configured. Example - QtDeclarative can now be configured like this: cd qtdeclarative-build-dir echo -qml-network > config.opt cmake -DOPTFILE=config.opt -DMODULE_ROOT=<source-root>/qtdeclarative \ -DCMAKE_COMMAND=<install-prefix>/bin/qt-cmake-private \ -P <source-root>/qtbase/cmake/QtProcessConfigureArgs.cmake A convenience script that saves the user from entering this unwieldy incantation will be added in a subsequent commit. Change-Id: If46103de3a8eb84b15e7600ebfec25544451e1d5 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix call to qt_apply_rpaths in qt_internal_add_appJoerg Bornemann2020-09-011-1/+1
| | | | | | | | | We never passed a valid target name to qt_apply_rpaths. This amends fde98f77945. Task-number: QTBUG-85399 Change-Id: I1c023ce30a3a8b5ec43d020373960d19fe20f59a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* CMake: Implement configure -traceJoerg Bornemann2020-09-012-6/+33
| | | | | | Task-number: QTBUG-85373 Change-Id: Ib9ac35ec98dd5b6c272f58f8a61a124d1d262ec0 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix cmake wrapper creation when cross-buildingAlessandro Portale2020-08-281-3/+3
| | | | | Change-Id: I363ee470973df89d16314671e3c33771040061f2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix rpath for Qt internal applications (non-bootstrapped tools)Joerg Bornemann2020-08-281-0/+4
| | | | | | | | | We need to call qt_apply_rpaths for targets that are created with qt_internal_add_app too. This is in line with what qt_app.prf does. Task-number: QTBUG-85399 Change-Id: If5ffb05cca191c6cae9a330e1f4556d342a68ff8 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: add option to get app arguments with AndroidManifest.xmlAssam Boudjelthia2020-08-281-1/+225
| | | | | | | | | | | AndroidManifest.xml file and the Android plugin already has a way to provide commandline-arguments to app with the tag "android.app.arguments". This change allow to set it from qmake/cmake and allow Qt Creator to use that. Task-number: QTCREATORBUG-23712 Change-Id: I3e680f40fd36ba6aaac7f344fb9509d2c3360e74 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* CMake: Implement configure -force-assertsJoerg Bornemann2020-08-272-1/+5
| | | | | Change-Id: Ife15b8d008c5b3f5eed61ec3bc048fda4c4b4e46 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Install QtHeadersClean.cmakeFabian Kosmale2020-08-271-0/+1
| | | | | | | | | For prefix builds we need to install the file. Amends db21bad936a761f475145886f1e06dfcfa11eb80. Change-Id: Ia8e859dc048cc4bd74eb95ed0d2adce9c6b11902 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* cmake: Fix generation of third-party attributesKai Koehne2020-08-261-1/+1
| | | | | | | Fix name of target so that qtattributionsscanner actually generates content. Change-Id: Ie42067928d7cd1de02fa4ae92a0f5ef54bd54a5c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* cmake: Fix building documentation on WindowsKai Koehne2020-08-261-6/+6
| | | | | | | Make sure the executable path contains an .exe on Windows. Change-Id: I972a3aaf1ad0510525ebfcc84e8c589f555c6d00 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* headersclean: Check for all-W3 MSVC warningsKai Koehne2020-08-261-6/+1
| | | | | | | | | | | | | | | C4180, C4458 were disabled already in 2012, in commit 6668f5becfb. C4577 was disabled due to QtScript being compiled without exception support in commit 97d7d80e735. Anyhow, Qt Script is now officially gone in Qt 6, and Qt headers do work just fine with C4180. Finally, C4458 is nowadays a W4 warning, so not enabled in the first place. Task-number: QTBUG-82615 Change-Id: I2f9b8e858817876b069a166129fbfac7ef3587a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Port headersclean check to CMakeKai Koehne2020-08-253-0/+147
| | | | | | | | | | | | | | | | | | | | | | | | Configure Qt with -DQT_FEATURE_headersclean=ON to enable the check. There will be separate target for each module include (e.g. QtCore_header_check), but the check will also be done when the module is built for the first time. There are notable differences to the qmake version: - the build does not pick up anymore default defines or flags from the module, or Qt. Instead options like -fPIC they have to be listed explicitly. Also for this reason, we have to skip the vulkan-related headers from the check, since vulkan/vulkan.h is not necessarily in the compiler's default search path. - some checks for nowadays unsupported compiler versions are removed. - -Wdouble-promotion -Wshorten-64-to-32 is not added for clang builds; the qmake code path did never enforce that on CI machines (it was non-Apple clang only), and the check currently fails on these configurations. Fixes: QTBUG-82615 Change-Id: I1cd303677b1472116910b6c27748f96436feb35e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: use definitions when testing EGLSamuli Piippo2020-08-251-0/+1
| | | | | | | Use any definition from pkgconfig for the EGL compilation test. Change-Id: I95c659b87ab7b0de81f000e3f52195161a493ef5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -gdb-indexJoerg Bornemann2020-08-232-1/+5
| | | | | Change-Id: Iea0fb99297751b1baf830a416ea5041d0b9a3b63 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Actually evaluate AUTODETECT expressions in featuresJoerg Bornemann2020-08-231-1/+2
| | | | | | | | Very simple AUTODETECT expressions worked fine, but expressions with parentheses, for example, were not correctly evaluated. Change-Id: Ibec4fa55474e149a701f861838fdea41d31beca0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support configure tests of type 'linkerSupportsFlag'Joerg Bornemann2020-08-232-0/+29
| | | | | | Task-number: QTBUG-86155 Change-Id: I3764d99cd4ad1c432b499ec9ba7c4c48391fa421 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -optimize-sizeJoerg Bornemann2020-08-232-1/+6
| | | | | | | | | | | | This configure switch controls the feature 'optimize_size'. This isn't merely a mapping to CMAKE_BUILD_TYPE=MinSizeRel, because we potentially want to combine -optimize-size with -force-debug-info, which maps to CMAKE_BUILD_CONFIG=RelWithDebInfo. Task-number: QTBUG-85373 Change-Id: I1a9343ebc54816f52e90e9d33ea3df4c99b1ec9f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix configure setting superfluous featuresJoerg Bornemann2020-08-231-5/+7
| | | | | | | | | | | | | Command line options like -debug result in setting the variable INPUT_debug. INPUT_debug is mapped to the CMake argument -DCMAKE_BUILD_TYPE=Debug. INPUT_debug also matches the feature 'debug', and the CMake argument -DFEATURE_debug=ON was passed. Do not pass -DFEATURE_xxx CMake arguments for inputs that are already handled. Change-Id: If096dff1c6dd694545c6f671f5f3512a43c3ec50 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Document more configure argument mappingsJoerg Bornemann2020-08-231-3/+3
| | | | | Change-Id: Icda71c14cde638e874cc2e6406527b9c98535165 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix creation of host-qmake wrapper when cross-compilingAlexandru Croitor2020-08-231-1/+2
| | | | | | | | | The -host prefix was added to the 'preliminary' directory rather than the actual wrapper shell script. This caused it to be overwritten every time by the cross-compiled qmake binary. Change-Id: I103811c6aa9181fa701e3e7ecaf828ecdd1e3c90 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Implement configure -optimize-debugJoerg Bornemann2020-08-202-1/+8
| | | | | | Task-number: QTBUG-85373 Change-Id: I3aba1fcf96e36544dd75a5e6adc5f770a9a45726 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>