summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Ignore license-related configure argumentsJoerg Bornemann2020-10-172-3/+5
| | | | | | | | | | Do not print warnings for the configure arguments -commercial, -opensource and -confirm-license. We're not removing the arguments yet to keep existing build scripts working. Fixes: QTBUG-86096 Change-Id: Ieb63e2f2b81c022e8559cde6c3e0be0b8ce655ca Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Generalize the winmain/qtmain entry-point libraryTor Arne Vestbø2020-10-172-6/+6
| | | | | | | | | | The use-case is relevant for other platforms as well. Now that Qt has a module system we can also replace a lot of the hand crafted logic for linking with simpler constructs. Change-Id: Ib6853aaf81bfea79c31f2de741d65b4b56f23ef6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Fix logic for adding staticlib to module priTor Arne Vestbø2020-10-161-4/+3
| | | | | Change-Id: I2426e78bb509a37e7e3924506903cd84732f88d8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Rename some public API functionsAlexandru Croitor2020-10-163-4/+4
| | | | | | | | | | | | | | | | | | | Some of them have a different (hopefully better) name now. Some are marked as Technical Preview. Some are renamed to be internal. Marking add_qt_gui_executable as TP with the intention to un-TP it after we rename it and change its behavior as discussed in the API review meeting. Additional changes to add_qt_gui_executable and qt6_add_resources have been filed as separate tasks that will be worked on separately. See comments on PS1 for details. Task-number: QTBUG-86827 Change-Id: I56a84a1943b0902bb807310dc620eb381824e8dd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Autodetect Android toolchain file and NDKJoerg Bornemann2020-10-133-18/+34
| | | | | | | | | | | | | | | | | | | | The Android toolchain file is now autodetected from the location of the NDK. The NDK location can be specified by setting the CMake variable ANDROID_NDK_ROOT. Auto-detection of the Android toolchain file is the only purpose of this variable. In recent Android SDK installations the path to the NDK is well-known and can be auto-detected too. If only ANDROID_SDK_ROOT is given, we try to detect ANDROID_NDK_ROOT first and from that the Android toolchain file. Adjust the build instructions in cmake/README.md, and remove the part where we suggest to set some environment variables that are only used to create the cmake call. Task-number: QTBUG-87068 Change-Id: Ia0df5df7651e98979e9cead1cdae7b17ecbc4afb 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 the -sanitize configure optionJoerg Bornemann2020-10-122-1/+10
| | | | | | | | This needs to map to ECM_ENABLE_SANITIZERS. Fixes: QTBUG-87316 Change-Id: I9e983728af0ba69fd428944e647f0afae8c61772 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow customization of the generated CMake toolchain fileAlexandru Croitor2020-10-121-0/+19
| | | | | | | | | | | | | | | | | | | | | Provide two customization points: - optionally include a 'qt.toolchain.extra.cmake' file if it exists and is placed next to the main generated toolchain file. This use case is mostly for the Qt installer, so that it can create an extra file with correct installer-provided paths, instead of patching the toolchain file directly. - optionally include a file passed via the command line CMake argument 'QT_TOOLCHAIN_INCLUDE_FILE'. The use case is for application developers that might want to adjust the toolchain file after the modifications done by the Qt installer. These options do not replace the existing QT_CHAINLOAD_TOOLCHAIN_FILE option, which is meant to chainload a platform specific existing toolchain file (like Android or Emscripten). Task-number: QTBUG-87068 Change-Id: I956949840f55742cfbd3bc8fc0bd8c6b3f774d3d Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Split QtBaseGlobalTargets.cmake into multiple filesAlexandru Croitor2020-10-124-266/+301
| | | | | | | And wrap the various behaviors into separate functions. Change-Id: If940351af34e445de050f2b46301de7080b1555b Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Implement missing iOS-related configure optionsAlexandru Croitor2020-10-124-12/+16
| | | | | | | | | | | | | | | Detect an iOS build when either an -sdk option is passed or when -xplatform macx-ios-clang is passed as a target mkspec. Now that CMake 3.17 is released, change the default behavior of the iOS build to configure with simulator_and_device set to ON, like it is with qmake. Update the documentation regarding iOS configuration. Change-Id: I91aaf706610b8d3c69f1ad4ba9dadee2b1e5db97 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Rename some additional functions that should be internalAlexandru Croitor2020-10-122-3/+3
| | | | | | | | | Amends e0c62a48b8a826a46a143e57e94b2a0ea73c7cae Task-number: QTBUG-86815 Change-Id: Ic65d8dda1aed390c78408616fb22f38edd2e1dce Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Workaround iOS Xcode issue when configuring appAlexandru Croitor2020-10-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It appears that CMake's Xcode generator default behavior can't really handle imported object libraries location, which Qt uses extensively (all the qt_add_resource calls). Specifically the project fails to configure with the following error message: The OBJECT library type may not be used for IMPORTED libraries under Xcode with multiple architectures. An issue was filed upstream at https://gitlab.kitware.com/cmake/cmake/-/issues/21276 In the mean time, it looks like it's possible to work around the issue by setting XCODE_EMIT_EFFECTIVE_PLATFORM_NAME global property to OFF. This needs to be done before the very first project() call, so we do it in the generated Qt toolchain file. Note that the workaround only works if the CMake project is configured with a single architecture given to CMAKE_OSX_ARCHITECTURES. If multiple arches are given, it will fail with the same error message. Fixes: QTBUG-87198 Change-Id: I2556ae28b2fc2d9cfe464a5acf9c4fcbaf01b654 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Set some additional info variables in Qt6CoreConfigExtrasAlexandru Croitor2020-10-121-0/+14
| | | | | | | | | | Add info whether Qt was an infix built, and whether the reduce_exports feature was enabled. These variable were set before in Qt5CoreConfigExtras.cmake. Change-Id: Id077763cfffd5ee6f1a7a28d04cf92dc46390c54 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Introduce Qt6::Startup targetAlexandru Croitor2020-10-124-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | Add an abstraction over Qt::WinMain (aka qtmain.lib) and iOS's runtime linker entry point (_qt_main_wrapper). The Core target will now link against the Startup target on all platforms, instead of just WinMain on Windows. The creation and linkage interface definition of the Startup target is done at find_package(Qt6Core) time via the private call of _qt_internal_setup_startup_target(). This will add automatic linkage of WinMain to executables marked with the WIN32_EXECUTABLE property on Windows. As well as the addition of the '-Wl,-e,_qt_main_wrapper' linker flag when linking iOS executables. Qt users can opt out of this behavior by either setting the QT_NO_LINK_QTMAIN property or variable. This is in line with Qt 5 behavior. Task-number: QTBUG-87060 Change-Id: I7d5e9f1be0e402cf8e67e6f55bfd285f9e6b04f4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* win: Set correct target mkspec for qmake builds for arm64 buildsOliver Wolff2020-10-091-1/+5
| | | | | | | | | | As there is no other way of obtaining information about Qt's paths at the moment, windeployqt is still querying qmake for these information. For a cross compiled Qt, the proper target mkspec has to be set in this case. Change-Id: I0b7b7719c9055d432576185ac4f7572a5ba1dd6b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix tool targets for top-level cross-buildsJoerg Bornemann2020-10-091-0/+6
| | | | | | | | | | When loading the tool packages from the host Qt we must ignore QT_NO_CREATE_TARGETS. Otherwise tool targets like Qt6::moc are not available. Task-number: QTBUG-85080 Change-Id: I2c8c8e68863f28a4f1d9cd2f70090455c49d8df2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Do not build tests and examples by default for configure -cmakeKai Koehne2020-10-081-16/+26
| | | | | | | | | | | | | | Tests were never built by default, except for -developer-build. Examples were build, but aren't anymore by default if you run cmake directly. Let the default be figured out by cmake, and only set BUILD_EXAMPLES and BUILD_TESTING if the user has expicitly passed them via -make or -nomake. Task-number: QTBUG-87217 Change-Id: I37321d96cc1e9e184a711a858c860b0205d5b74f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Remove outdated info from README.mdKai Koehne2020-10-081-3/+0
| | | | | | | | | 3.17.0 is released since a while. ANyhow, the requirement for 3.17 for simulator_and_device builds is already mentioned at the start. Change-Id: Ic8813bb60b010feb97a47b878124c3e75658813d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix leftover usage of qt_add_executableAlexandru Croitor2020-10-074-34/+34
| | | | | | | | | | | All usages should be replaced with qt_internal_add_executable instead. This should fix configuration failure of benchmarks and manual tests. Amends e0c62a48b8a826a46a143e57e94b2a0ea73c7cae Task-number: QTBUG-86815 Change-Id: I0791d849998ed9517e32f699d843367949b97cb9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Issue warning if chainloaded toolchain file does not existJoerg Bornemann2020-10-071-0/+3
| | | | | Change-Id: Ib7e9b172c6e42feb074955786d49b071639ca86e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Introduce QT_CHAINLOAD_TOOLCHAIN_FILEJoerg Bornemann2020-10-072-0/+5
| | | | | | | | | This variable can be set when using qt-cmake[-private] to override the CMake toolchain file that is chainloaded by Qt's toolchain file. Task-number: QTBUG-87068 Change-Id: Id529408381e4174becda1ba07a489535c8cf1314 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Document convenience scripts in READMEJoerg Bornemann2020-10-071-0/+45
| | | | | Change-Id: I7ec7f01f744285fc086de8a0430afbf49563adce Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add missing Android values in qdevice.priAlexandru Croitor2020-10-071-0/+7
| | | | | | | | | | | These were introduced in 675805e9eb0dc68a6e96622353073fd54161bdaf and b9c85d6b0e274bf0a6287cd56d9e3d7376b0d004 They should be exported if they were set. Change-Id: Ieec565980ba148f675f84dcdd7c19894e349085f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Export the chosen iOS SDK used when configuring QtAlexandru Croitor2020-10-071-0/+4
| | | | | | | | | | | | | The value is used by mkspecs/features/mac/default_post.prf and ultimately by xcodebuild to decide which arch and SDK to build against. For a simulator_and_device build, no value needs to be set as far as I can see. Task-number: QTBUG-87218 Change-Id: I41992bec6b16aadfd87c3f7c10653a6094e76d3e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Add iOS mkspec mapping for the wrapper qmakeAlexandru Croitor2020-10-071-0/+2
| | | | | | | | | | If no mkspec is provided, we default to the macx-clang-ios mkspec when building for iOS. This ensures that the wrapper qmake script is usable for building iOS apps with qmake. Task-number: QTBUG-87218 Change-Id: Ib02b580c8382b04455c9f820163062591d14a15b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Remove leftover debug outputAlexandru Croitor2020-10-061-1/+0
| | | | | | | Amends 07b6d3367debd8f15974abf0f5cdf48f0fe3a536 Change-Id: I8d5922af13903c6a10f967035bca70a89b19f86f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow embedding debug info in object files with MSVCAlexandru Croitor2020-10-061-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new feature called 'FEATURE_msvc_obj_debug_info' which should allow usage of sccache for Windows MSVC configs. Enabling the feature will replace the default '/Zi' compile flag that CMake sets in Windows-MSVC.cmake with '/Z7'. This ensures that the debug info is placed into the compiled object file instead of placing it in the compilation .pdb file via mspdbsrv.exe. The final pdb file will still be created for shared libraries and executables due to the linker '/debug' flag. Static libraries will not have a .pdb file, instead the debug info being embeeded in the .lib file. The downsides of using '/Z7' are more disk space usage, slower link times, more memory used for linking because the linker needs to deal with more symbols. The upside is that caching each indepedent cl.exe call is possible. This is what Chromium uses with goma, and Firefox with sccache. We're not enabling the feature by default to allow easier testing (and switching it off) in the CI if it proves not to be feasible. It will probably have to be disabled at least for building qtwebengine due to high memory requirements. Task-number: QTQAINFRA-3934 Change-Id: I89e0e57995e938a780be318d1faec700194aa93f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Introduce CMake-only optimize_full featureAlexandru Croitor2020-10-061-0/+9
| | | | | | | | | Enabling it will force usage of '-O3' flag when building Qt. If the platform has no '-O3' flag, use '-O2' as a fallback. Task-number: QTBUG-86866 Change-Id: If13f7de954ba5c01dc9634f06a85529828fe90a9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Refactor optimization flag handling and add optimize_fullAlexandru Croitor2020-10-063-56/+483
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a bunch of helper functions to manipulate compiler flags and linker flags for the CMAKE_<LANG>_FLAGS_<CONFIG> and CMAKE_<LINK_TYPE>_LINKER_FLAGS_<CONFIG> CMake variables. These variables can be assigned and modified either in the cache or for a specific subdirectory scope, which will apply the flags only to targets in that scope. Add qt_internal_add_optimize_full_flags() function which mimics qmake's CONFIG += optimize_full behavior. Calling it will force usage of the '-O3' optimization flag on supported platforms (falling back '-O2' where not supported). Use the function for the Core and Gui subdirectories, to enable full optimization for the respective Qt modules as it is done in the qmake projects. To ensure that the global qmake-like compiler flags are assigned eveywhere, qt_internal_set_up_config_optimizations_like_in_qmake() needs to be called after Qt global features like optimize_size and optimize_full are available. This means that qtbase and its standalone tests need some special handling in regards to when to call that function. Task-number: QTBUG-86866 Change-Id: Ic7ac23de0265561cb06a0ba55089b6c0d3347441 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Install PDB debug info for MSVC buildsAlexandru Croitor2020-10-065-0/+71
| | | | | | | | | | | | | | | Supports installing linker generated debug info for shared libraries and executables, as well as compiler generated debug info for static libraries. Works with Ninja Multi-Config as well, with the caveat that the files are installed optionally, aka the install rule will not error out if a pdb file is not present. This is necessary, because it's not possible to create per-config install rules properly. Fixes: QTBUG-87006 Change-Id: I95e91a6557eb0ee0f882103be54cd38795c349f7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Implement missing Android-related configure optionsJoerg Bornemann2020-10-062-6/+39
| | | | | | | | | | | | | | Implement the last remaining Android-related configure options for the CMake build. Print warnings for options that have no equivalent in the CMake build. Let -android-ndk automatically deduce the CMake toolchain file, and error out if that fails with a hint how to fix the situation. Task-number: QTBUG-85373 Change-Id: I8399e5334ae0f1f6634e381775a308d34f7c482b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Extend message functions in QtProcessConfigureArgs.cmakeJoerg Bornemann2020-10-061-4/+8
| | | | | | | | | | qtConfAddWarning was missing, despite being used. All of the three qtConfAdd* functions take multiple parameters and pass them to the CMake's message() function. Change-Id: I1fad46c6fd00b2e733b32cda482bbf1341ffc63f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix typo in ANDROID_SDK_ROOT's help textJoerg Bornemann2020-10-061-1/+1
| | | | | Change-Id: I1edc7e7ae443c306aca64b8f6a92c8b32fad6117 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -reduce-exportsJoerg Bornemann2020-10-053-8/+9
| | | | | | | | | | | | | | | | | This option maps to FEATURE_reduce_exports. The feature is on by default, except for MSVC. The reduce_exports configure test is not used in the CMake build. The <LANG>_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties are now explicitly initialized in the qt_set_common_target_properties function, because we don't have access to the feature in QtSetup.cmake where the CMAKE_<LANG>_VISIBILITY_PRESET variables were set before. Task-number: QTBUG-85373 Change-Id: I378453f0e0665731970016170302871e20ceb4e2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Clean up the public API a bitAlexandru Croitor2020-10-011-1/+1
| | | | | | | | | | Add some missing versionless functions. Rename some functions that are not meant to be public API, and their usages. Task-number: QTBUG-86827 Change-Id: Ifb66c04cd7598d83fe80c01a92ab2d269ebaf396 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix -[no-]warnings-are-errors configure argumentJoerg Bornemann2020-10-012-2/+2
| | | | | | | | The CMake build uses the WARNINGS_ARE_ERRORS variable, and the feature warnings_are_errors exists only in the qmake build. Change-Id: I1e548b30b210b3dd1b2f23041d490a981312f4ba Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: use HostInfo when QT_HOST_PATH is setSamuli Piippo2020-09-301-0/+3
| | | | | | | | | HostInfo is used in places whenever QT_HOST_PATH is set, regardless whether CMAKE_CROSSCOMPILING is set or not. Make sure that HostInfo is available when QT_HOST_PATH is set. Change-Id: I39763a61d77e97dc9c4cc3875bce4deb942f870a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: fix sdkBuildToolsRevision not being set for user appsAssam Boudjelthia2020-09-291-25/+3
| | | | | | | | | | | Add qt6_android_get_sdk_build_tools_revision() function to get the Android SDK build tools revision, the logic is moved from QtPlatformAndroid to Qt6AndroidMacros. The update QtPlatformAndroid header comments. Task-number: QTBUG-85982 Change-Id: If3e5b46fa583f929a24794792c9d5a52beb83990 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: make QT_ANDROID_DEPLOYMENT_SETTINGS_FILE consistent with qmakeAssam Boudjelthia2020-09-281-2/+2
| | | | | | | | | Make name format of QT_ANDROID_DEPLOYMENT_SETTINGS_FILE consistent with qmake, that is android-${target}-deployment-settings.json. Task-number: QTCREATORBUG-24678 Change-Id: I2bdb056cf7a82fd83aaf658f3a405a0c9ef05756 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Generate *AdditionalTargetInfo.cmake for toolsJoerg Bornemann2020-09-283-1/+9
| | | | | | | | | | This ensures that we have the configuration-independent IMPORTED_* properties set on tools. Fixes: QTBUG-86893 Change-Id: I2b772c21341e6e4631379d4a5a99580ec96909ed Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Write proper *AdditionalTargetInfo file in debug-only buildJoerg Bornemann2020-09-281-25/+29
| | | | | | | | | | To provide the IMPORTED_LOCATION target property we must write the *AdditionalTargetInfo.cmake file for all debug-only builds, not only the ones containing a release configuration. Task-number: QTBUG-86893 Change-Id: I9ecd01483660f434a3f1ea12fa2af756cdcf9932 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: FindGLIB2 to include gthread2 sub-libraryJulien Schueller2020-09-281-2/+10
| | | | | | | | Avoids undefined references to g_thread_init. Fixes: QTBUG-86727 Change-Id: Ic41b0dab9e4e23083faf4e9abcf7acc517172e49 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* By default don't try to use pkg-config when targeting AndroidAlexandru Croitor2020-09-281-1/+1
| | | | | | | | | | It causes issues in our Windows CI, because the strawberry perl pkg-config is found. And even that one is unusable, due to a bug in CMake which is tracked at https://gitlab.kitware.com/cmake/cmake/-/issues/21239 Change-Id: I58816195d35459e8a44c923399c35a4956c222a2 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* CMake: Allow finding Qt CMake packages in additional locationsAlexandru Croitor2020-09-283-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, when using the Qt6 CMake package to look for components, the find_package() calls for the components use NO_DEFAULT_PATH to ensure that CMake doesn't accidentally find system (distro) packages. Instead we limit the paths to one level up from where the Qt6 package is. Unfortunately that doesn't quite work for finding Qt packages that might have been installed into a different prefix than where the main Qt prefix is. This happens when Qt addons are built by Conan, and installed into a separate prefix. To allow calls like find_package(Qt6 COMPONENTS ConanAddon) to work in a scenario as described above, introduce a new variable called QT_ADDITIONAL_PACKAGES_PREFIX_PATH which can be used to specify additional paths where Qt CMake packages should be found. This is similar to previously introduced QT_EXAMPLES_CMAKE_PREFIX_PATH variable which was meant for a similar case, but only for examples. Additionally, allow disabling the NO_DEFAULT_PATH option by setting the QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES cache variable to TRUE. This would allow regular usage of CMAKE_PREFIX_PATH to work, at the risk that system Qt CMake packages might be found. Augments 5cd4001bf2a7f0894c6ac269860e833b02df6cde and ffe088941378e32ea30c142cca7e63c537a41ff1. Fixes: QTBUG-86882 Change-Id: Ia8e060cbba6d2a10c3d63d81892f2c71e4236a9a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: use ANDROID_SDK_ROOT instead of ANDROID_SDK consistentlyAssam Boudjelthia2020-09-261-1/+1
| | | | | | | | Make the use of ANDROID_SDK_ROOT consistent. Task-number: QTCREATORBUG-24678 Change-Id: If967bdc4d252996098fa210cf38429fe075eacb1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add $import_prefix/include as an include path for each Qt moduleAlexandru Croitor2020-09-261-0/+8
| | | | | | | | | | | | | | | To support finding Qt headers of modules installed into a different prefix than the main one, add the $import_prefix/include path as a public include path for each built Qt module. With this, includes like #include <QtNetworkAuth/QOAuth2AuthorizationCodeFlow> will work. The macOS framework case is handled automagically by CMake, which ends up passing '-iframework $import_prefix/lib'. Change-Id: I02ce9cacf157aab9721c1d6073a377607c5b89c7 Fixes: QTBUG-86881 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix build of Release user projects against RelWithDebInfo QtJoerg Bornemann2020-09-257-0/+115
| | | | | | | | | | | | | | | | | | | | | Building a user project in Release configuration against a Qt built with CMAKE_CONFIGURATION_TYPES=RelWithDebInfo;Debug led to the user project being linked against the Debug Qt libraries. This is especially painful with MSVC where debug and release runtimes are incompatible. We now create *AdditionalTargetInfo.cmake files along the exported *Targets.cmake files that set the IMPORT_*_<CONFIG> properties to the values of the release config Qt was built with. User projects built with an unknown configuration (CMAKE_BUILD_TYPE=ArbitraryName) will link against a release Qt. This can be controlled by setting the variable QT_DEFAULT_IMPORT_CONFIGURATION to, for example, DEBUG in the user project. Fixes: QTBUG-86743 Change-Id: I12c4b065a9845c7317f6acddab46b649f2732c9e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Export 3rdparty dependency find_package calls of private modulesJoerg Bornemann2020-09-251-1/+12
| | | | | | | | | | | | | | | | Consider a Qt module with a 3rdparty library target in PRIVATE_MODULE_INTERFACE, e.g. XKB::XKB in Qt6::GuiPrivate. Consumers of GuiPrivate automatically depend on XKB::XKB. In order to do that they must find_package(XKB ...). As all find_package calls for GuiPrivate are in the same place as the ones for Gui, this package must be marked as optional. Otherwise all consumers of Qt6::Gui would have to have the xkbcommon package installed too. This patch exports find_package calls for every 3rdparty public dependency of private modules and marks them as optional. Change-Id: Ia1eeb09c29927fb6634ef08b477684ed6f123267 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix sanitizer build when using Clang on LinuxAlexandru Croitor2020-09-241-0/+3
| | | | | | | | | | | | | | Apparently the combination of the --no-undefined linker flag together with ASAN when building on Linux with Clang does not work. Disable --no-undefined flag in such a scenario. Note that linux-clang mkspec doesn't add that flag at all, which is why asan builds work there. Change-Id: I6167c757ce4be5d2263311bc84e5fb445b0f7c2d Fixes: QTBUG-86879 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake Build: Add support for -qtlibinfix configure parameterCristian Adam2020-09-235-5/+9
| | | | | | | | | Rename all libQt6*.so to libQt6*<infix>.so Task-number: QTBUG-85438 Change-Id: I4b91ffaaec7bea61454b0d3c794c77f2d0868d54 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>