summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
...
* CMake: Use test wrapper to run android testsAlexey Edelev2020-12-112-78/+168
| | | | | | | | | | | | | | | | | | | | Refactor test adding procedure. It's expected that for each new platform we prepare test executable and arguments first and then pass them to common test adding section. Rename '_qt_internal_wrap_test' to 'qt_internal_create_command_script' Rework paramerters handling of 'qt_internal_create_command_script', make them named. Add 'qt_internal_create_test_script' to add tests and wrap them using 'qt_internal_create_command_script'. Amends f19266bd02a01d4b7b277ea769c4c17727b1e661 Fixes: QTBUG-88053 Change-Id: I812f4a295005bf3a85cdcb5b8c41180f8249dc96 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit d5bafc80cd38202464576f3e0b38de645bb2dc64)
* CMake: Improve tests wrapper arguments handlingAlexey Edelev2020-12-111-2/+15
| | | | | | | | | | | | | Use 'separate_arguments' to explicitly split arguments from environment that form 'COMMAND' for execute_process. Enclose using bracket syntax arguments, that propagated to wrapper script as pure strings. Amends f19266bd02a01d4b7b277ea769c4c17727b1e661 Change-Id: I858ddff7efa281f9cecfda656a02e1fd12361758 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c0ebfb81de8fbd352b5a63973f5dde978599c08c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Document some missing configure cmake mappingsLi Xinwei2020-12-091-5/+5
| | | | | | | Change-Id: I4b15dde581e28aece52d7f98cb3d94827e8bcc33 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c9ac82f3b8e37a6db02c63e10b1de6909630c5f1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Do not write Effective[Source]Paths to target_qt.confJoerg Bornemann2020-12-081-17/+0
| | | | | | | | | | | This was needed, when the mkspecs directory was not present in the non-prefix build directory. That's not the case anymore. Fixes: QTBUG-89182 Change-Id: I2b04c2d857b0af324e1d7c41ed1934a62275d6f1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 192d37099da0db1b7bf7452c44daacc19b85094b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Disable static plugin imports for non-executable targetsAlexandru Croitor2020-12-083-1/+31
| | | | | | | | | | | | | | | There is no point in generating cpp files containing Q_IMPORT_PLUGIN() macro calls for non-executable targets like modules, plugins and object libraries in a static Qt build. It causes unnecessary compiling of 10+ files for each of those targets. In a static Qt build, plugin imports should only be done for executables, tools and applications. Change-Id: Ied90ef2f6d77a61a093d393cfdf94c400284c4f0 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit b3576164f0aedf8d528c3724332a36b0fb6d05e0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Offer to build manual tests through QT_BUILD_MANUAL_TESTSAleix Pol2020-12-082-2/+4
| | | | | | | | | | Disabled by default as they are currently not being built and many are not working properly, this will allow us to start using them again. Change-Id: I823368d04e9fde2beccabedc3ca15efd1f355bfb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 9d831491334e75f8ccc691edaeb173af81ab80ac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Force crosscompiling_emulator to empty string if not foundAlexey Edelev2020-12-071-3/+6
| | | | | | | | | | | | | | In some case CROSSCOMPILING_EMULATOR property is not INHERITED and is set to 'NOTFOUND' by get_test_property. Force it to empty string in this case. Add missed 'name' argument to '_qt_internal_wrap_test'. 'name' previously was used from parent scope. Fixes: QTBUG-88053 Change-Id: I5286bcb9b11659f638e178ce52172dfee994fc34 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 4a9ed410750c8b111d33c52544388904244ec6e5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Add -qt-host-path to configure's help screenJoerg Bornemann2020-12-071-1/+1
| | | | | | | Change-Id: Ia32377e08d72f82e71ce6f2c08e61bd8991b3077 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit a201ce7f11291cbb6810f295126fb3533edbdc53) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add extra targets to run single benchmark using CMake generatorAlexey Edelev2020-12-074-30/+49
| | | | | | | | | | | | | | | | | | | Add custom targets with '_benchmark' suffixes to make run of benchmarks using generators possible, e.g.: $ ninja tst_bench_qudpsocket_benchmark Extend '-[no]make' option to pass benchmark. Rework '-[no]make' processing to unify these options processing. Also looks like it doesn't make sense to enable benchmarks without having test enabled. So '-DQT_BUILD_BENCHMARKS' enables test as own dependency automatically. Task-number: QTBUG-89076 Change-Id: Ieee9eadaf6d75a1efec120242d6eb786ace1b071 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 61d5b019727dd1c06366205cb307a2a928a2a29c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Enable NEW policies by CMake version with a global defaultCraig Scott2020-12-0713-16/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a CMake release introduces a new policy that affects most Qt modules, it may be appropriate to make each module aware of that newer CMake version and use the NEW policy without raising the minimum CMake version requirement. To reduce the churn associated with making that change across all Qt modules individually, this change allows it to be updated in a central place (qtbase), but in a way that allows a Qt module to override it in its own .cmake.conf file if required (e.g. to address the issues identified by policy warnings at a later time). The policies are modified at the start of the call to qt_build_repo_begin(). For commands defined by the qtbase module, qtbase needs to be in control of the policy settings at the point where those commands are defined. The above mechanism should not affect the policy settings for these commands, so the various *Config.cmake.in files must not specify policy ranges in a way that a Qt module's .cmake.conf file could influence. Starting with CMake 3.12, policies can be specified as a version range with the cmake_minimum_required() and cmake_policy() commands. All policies introduced in CMake versions up to the upper limit of that range will be set to NEW. The actual version of CMake being used only has to be at least the lower limit of the specified version range. This change uses cmake_minimum_required() rather than cmake_policy() due to the latter not halting further processing upon failure. See the following: https://gitlab.kitware.com/cmake/cmake/-/issues/21557 Task-number: QTBUG-88700 Change-Id: I0a1f2611dd629f847a18186394f500d7f52753bc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 3859f15ec9fd333089e6eb1152a76592cd5f83c0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add handling of TESTRUNNER and TESTARGS by Qt testsAlexey Edelev2020-12-041-36/+137
| | | | | | | | | | | | | Wrap Qt tests to handle TESTRUNNER and TESTARGS environment variables. Variables are handled according to qmake build procedure. All test now are wrapped by generated CMake script. Fixes: QTBUG-88053 Change-Id: I339977ce6ce11ddd38a4bf0bd26eb8f2ae463ba3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit f19266bd02a01d4b7b277ea769c4c17727b1e661) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Build examples with qmake against a CMake built QtAlexandru Croitor2020-12-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | We want to remove the Qt .pro files for projects, except examples, because examples are still meant to build with qmake. To not lose coverage on examples built with qmake, add instructions that will build the qtrepo/examples folder with qmake when the CMake configuration has -DQT_BUILD_EXAMPLES=ON. This means that such configurations will build examples both with CMake and qmake. Aside from making sure that our examples will still build with qmake, it will gives us some some coverage that a CMake-built qmake works correctly. Implementation-wise, add new instructions files that can call qmake and make depending on configuration and target type. Fixes: QTBUG-85986 Change-Id: Ie8f4cbcda03c94da2aef455e32f48dad41a4bdb0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 24f12d0cefe00adfe1b11cf41efbb146d529a6cd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Avoid MSVC C4996 warningsLi Xinwei2020-12-041-0/+4
| | | | | | | | | | | | | | | | | | The qmake build system defines _CRT_SECURE_NO_WARNINGS in mkspecs/features/qt_module.prf, the cmake build system should do the same thing in qt_internal_add_module(). Adding this definition can avoid warnings like: warning C4996: 'strncpy': This function or variable may be unsafe. As a special case, Bootstrap uses add_library() instead of qt_internal_add_module(), so _CRT_SECURE_NO_WARNINGS should also be defined in src/tools/bootstrap/CMakeLists.txt. Change-Id: Ic82193d177f82785fd84948efa78c49ca8d8db46 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 013abe320680b3dcd3f6d7e4fb4880e590ba10e6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix arch parsing for oss-fuzzAlexandru Croitor2020-12-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'll preface by saying, it's not clear to me why the behavior is different. Our qt_run_config_test_architecture function builds a target executable, and then uses file(STRINGS) to try and parse out some magic strings that we expect the executable to have (architecture, abi, etc). In qmake this was done by matching with a regular expression ending on a \\0 null byte character. In CMake, we do a string(FIND) and string(SUBSTRING until the end of the line) on a *line* returned from file(STRINGS). Notably, I did not find any regexp syntax provided by CMake to try and match a null byte character. Note the docs for file(STRINGS) implies to me that *lines* are detected by looking for newline characters '\n'. The docs also mention that binary data in the file is ignored. What's binary data though? If you open the executable with a hex editor, at least on macOS, the strings we are interested in are indeed separated by null byte chars, not newline chars. On most platforms file(STRINGS) did end a line on the null byte character. Except, for some reason not when building Qt for the oss-fuzz project with clang under Docker. Calling message() on one of the lines prints a very long string with null characters seemingly replaced with semicolons, and of course the matched architecture string is wrong and fails configuration. For *some reason*, if I add a "REGEX ==Qt=magic=Qt==" option to the file(STRINGS) command, the captured output lines don't contain semicolons even when building for oss-fuzz. The extracted strings are then correct, and configuration succeeds. Use the REGEX option workaround, with the aim to quickly fix Qt building for oss-fuzz for 6.0.1 release. Fixes: QTBUG-89047 Change-Id: Iad11c1090c1187aadd39082f196050bf3290df95 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit f071ba31b2e441268518217cbe2ec4fe1c978b31) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix QMAKE_LIB_<NAME> variable names in module .pri filesJoerg Bornemann2020-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | | QMake libraries that contain dashes are referenced by QMAKE_USE as is, but the corresponding QMAKE_LIB_<NAME> variable must be normalized to contain underscores. Example from the qmake build: ./mkspecs/modules/qt_lib_waylandclient.pri 11:QT.waylandclient.uses = wayland-client xkbcommon wayland-cursor ./mkspecs/modules/qt_lib_waylandclient_private.pri 12:QMAKE_DEPENDS_WAYLAND_CURSOR_CC = WAYLAND_CLIENT 13:QMAKE_DEPENDS_WAYLAND_CURSOR_LD = WAYLAND_CLIENT 15:QMAKE_LIBS_WAYLAND_CURSOR = -lwayland-cursor Change-Id: If31bd45764d52f97d80d6388503008dc1ffb16ab Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit e32e4898dde1dc2a5ae19a1c3dc4609064258a43) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: mention the QT_BUILD_X_BY_DEFAULT=OFFGiuseppe D'Angelo2020-12-021-2/+7
| | | | | | | | | | | Which is probably the direct port of -nomake XXX, as qmake always offered the way to build tests/examples/etc. after configuring without, while cmake doesn't. Change-Id: I85b039e56cde3ddfaf661385100d3c3a8cc2ac16 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit b70ddde4b651d0825e7e12fdbc50271bd298eea8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fill QT.<module-name>.uses entries in module .pri filesJoerg Bornemann2020-12-012-5/+38
| | | | | | | | | | | | | | | | | Those entries were always empty. The INTERFACE_QT_MODULE_USES property was never set. Map each public dependency to its qmake lib name and place this value into the module's QT.<module-name>.uses variable. Take into account the "_nolink" target modifier and translate it to qmake's "/nolink". Fixes: QTBUG-88951 Change-Id: Ib6ef65b842a1fe1da3ade55867583343b4ee76ee Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 92d60ae589442cfbe1e7ac1bb4c42334a09af310) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Rename internal variableJoerg Bornemann2020-12-012-2/+2
| | | | | | | | | | | | Rename QT_QMAKE_LIB_TARGETS_foo to QT_TARGETS_OF_QMAKE_LIB_foo, because we want to introduce the counterpart QT_QMAKE_LIB_OF_TARGET_bar in a subsequent commit. Task-number: QTBUG-88951 Change-Id: I33f00f4fe65c5977da6e74c632ebeab3b891c89a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit bf483ca9794c8eaafd9007e7e76117bab5bfa35f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Do not discard empty QMAKE_LIBS_FOO entriesJoerg Bornemann2020-12-011-8/+8
| | | | | | | | | | | | | Consider a qmake lib 'foo' that doesn't have entries in QMAKE_LIBS_FOO. Then we must not discard this entry in the generated module pri file, because otherwise any attempt to QMAKE_USE 'foo' will fail with the error message "Library 'foo' is not defined.". Task-number: QTBUG-88951 Change-Id: Ibed283857f5f66b1b79459fe7b7cf06c7ce0691d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit bd98ba0d17b7a7c14fefc1741e68e8ca945a6655) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add debug information for 'qt_evaluate_config_expression'Alexey Edelev2020-12-011-3/+64
| | | | | | | | | | | | | Add '_qt_internal_dump_expression_values' function that dumps all values evaluated by 'qt_evaluate_config_expression'. '_qt_internal_dump_expression_values' doesn't evaluate undefined features, only collect actual values. Fixes: QTBUG-88476 Change-Id: I9d09ffbd9f9fa91bc4f36536c58e7f118b06f9b9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c140b26959038ada22452079ebc6e33195e9957d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix resource object file paths in prl files for prefix buildsAlexandru Croitor2020-11-302-8/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, the prl files always assumed that resource object files are installed into $qt_prefix/lib when doing a prefix build. That was true for qt_internal_add_resource calls, but not for qt6_add_qml_module and qt6_target_qml_files. Change qt_internal_record_rcc_object_files to take a new required INSTALL_LOCATION argument. The argument takes a path relative to CMAKE_INSTALL_PREFIX. Modify __qt_propagate_generated_resource to save the relative path of the generated resource source file, which will be used in the computation of the final resource object file location. This is needed because the Qml resource functions place the source files in a different directory layout, e.g. .rcc vs .qmlcache Modify qt_generate_prl_file to prepend $$[QT_INSTALL_PREFIX]/ instead of $$[QT_INSTALL_LIBS]/ for the resource install paths. A follow up patch is done in qtdeclarative to pass the new INSTALL_LOCATION argument from the Qml CMake functions. Amends f9dcade5e795a631b9a2d93c855aa8198d58e24e Task-number: QTBUG-87702 Task-number: QTBUG-88425 Change-Id: Id17bb517b4cb5d00911bfd10a728ba4e0d44871b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 54d0ca93bca78f8fd31b6761f078e7a96283f183) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Handle empty INCLUDE_DIRECTORIES in genex for qdocCraig Scott2020-11-301-1/+1
| | | | | | | | | | | | | | | | Follow the pattern recommended in the CMake docs for the $<JOIN:...> generator expression. Wrap it in a $<BOOL:...> genex so that if a target's INCLUDE_DIRECTORIES property is empty, we don't add a stray -I with no directory following it. This fixes the following error when running qdoc: qdoc: Missing value after '-I'. Task-number: QTBUG-88838 Change-Id: Ie3ef2625fbb29cc501f7fc22ff7a9cc8ac548322 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit bac73a36e25076a5929c7feac0675860772e7270) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: strip the executable bit from qt-cmake-private-install.cmakeChristophe Giboudeaux2020-11-301-1/+1
| | | | | | | | | | Despite being installed in the the binary directory, this CMake snippet cannot be executed. Change-Id: Ibfd31e51184f0688d19ac063804cc200c95555a7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 687bd03d09b42faad4c8790c9508518c3d14b456) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix headersclean interaction with header only modulesAlexandru Croitor2020-11-261-12/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before CMake 3.19, we are not allowed to query non INTERFACE_ prefixed property names from INTERFACE libraries. And it was the wrong thing to do as well. Prefix the properties with INTERFACE_ as appropriate. Don't try to add INTERFACE_COMPILE_DEFINITIONS from header only modules to the headerclean compile commands. This causes configuration issues with UiPlugin in qttools. Fortunately it seems that qmake doesn't do that for 'header_module's either. Finally don't query for the FRAMEWORK property on the passed target (INTERFACE libs can't be frameworks). Instead just query if the whole Qt build itself is a framework build. An issue was discovered regarding QT_NO_ENTRYPOINT genexes breaking headersclean add_custom_commands for UiPlugin in qttools. To avoid this the property was renamed to all lower case in 6ca66de9120537134b63d42de6c53c6e5834e8f3. This avoided the immediate issue, but it's possible it might resurface in the future with a different property name that wasn't renamed. In particular I thought it might happen with QT_NO_UTF8_SOURCE but it didn't. In case something like that happens again, the two possible solutions are to bump minimum CMake version requirement to 3.19 (where upper case property names are allowed to be queried from INTERFACE libs) or to implement recursive include directory fetching similar to our qt_internal_walk_libs implementation. Task-number: QTBUG-86053 Task-number: QTBUG-82615 Change-Id: I7815d555ec9ea049a8fd40f2a2f072dcb9f5e9c3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 9b84ea6b47979b5d789b72f9f74326ecbe3a579a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Use cmake_language(DEFER) when available for scope finalizersAlexandru Croitor2020-11-262-14/+31
| | | | | | | | | | | | | | | If CMake version is 3.19 or greater, use cmake_language(DEFER CALL) for Qt internal scope finalizers, instead of the homegrown implementation. Apart from not depending on the hacky homegrown solution, it significantly improves the readability of --trace-redirect logs. Task-number: QTBUG-77377 Change-Id: I5ce374bb313865662c536826e86052bc762438b9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 69d9b2b6fdd5cd28aa7dca2636eb2f411277ad30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Allow generating documentation for INTERFACE targetsAlexandru Croitor2020-11-261-2/+9
| | | | | | | | | | | | | Query the include dirs from the INTERFACE_INCLUDE_DIRECTORIES property when generating docs for an INTERFACE library. Amends 2db41fefa006c9aabd577eee98b8a9594d264470 Task-number: QTBUG-88838 Change-Id: Ic8a454ba66b2dbc59bad883e1e0d38ebb26d0370 Reviewed-by: Cristian Adam <cristian.adam@qt.io> (cherry picked from commit a9d687c63c31b18396247c3e69e6b48211ab0ae0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix value of QMAKE_PRL_TARGET in generated .prl filesJoerg Bornemann2020-11-261-1/+1
| | | | | | | | | | | | On DLL platforms, the value of QMAKE_PRL_TARGET should be the import library (foo.lib), not the actual DLL (foo.dll). The genex TARGET_LINKER_FILE_NAME provides exactly that. Fixes: QTBUG-88864 Change-Id: I553930bb840007772fe8f4612f95e0e320f54107 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 89b49e52310c5b5e1549e78b334749c4f486cc7f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Restore QT_STAGING_PREFIX in qt-cmake-standalone-test generationAlexey Edelev2020-11-241-3/+12
| | | | | | | | | | | | | Restore 'QT_STAGING_PREFIX' logic when generating 'qt-cmake-standalone-test'. Relative paths now calculating depend on 'QT_STAGING_PREFIX'. For prefix builds QT_STAGING_PREFIX should be prepend to '__qt_cmake_standalone_test_path' Fixes: QTBUG-88764 Change-Id: I655c60847f2ab872948cfe9aedc27835e5cc4fb5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 7f1e145f7ee885d8c6b29d02206711040b65f6f6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Rename QtBuildInternalsAndroid.cmake to QtAndroidHelpers.cmakeJoerg Bornemann2020-11-244-15/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...and include it in QtBuild.cmake. Commit e8d8b1a5e4c added two different code paths to include QtBuildInternalsAndroid.cmake. This was needed, because: In a top-level build, we must not include files that are not yet installed. We have the source tree available, and "${QT_SOURCE_TREE}/cmake" is in CMAKE_MODULE_PATH. We can use the "module syntax" of the include() command. In a per-repository build, when building against an installed qtbase, we must not include files of the source tree, because that's not guaranteed to be available. However, Qt6BuildInternalsConfig.cmake is installed, and we can directly include QtBuildInternalsAndroid.cmake, which is right next to it. We can circumvent this whole issue by moving the Android-related functions out of the Qt6BuildInternals package and including it in QtBuild.cmake. Task-number: QTBUG-88718 Change-Id: I5192ba19bb77952505c20d053d7285f798d16ac5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 0274daf30779ba08fc708247a3e645fd44980280) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix Android non-top-level build against qtbaseJoerg Bornemann2020-11-231-1/+6
| | | | | | | | | | | | | | | | | Commit 9e0fb9c4fbe7a11c09a70d7ea1be97405c6bf0f8 introduced build failures in non-top-level builds when building Qt modules against qtbase. This was observed on in the CI for CentOS. Partly revert above commit by taking the old code path for non-top-level builds. Fixes: QTBUG-88718 Change-Id: I8926e1e4628ec5bdcea99e10497c1f65c10d072d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 510186a218e63c88100efc38cb1611f122f94570) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Name QT_NO_MAKE_*/BUILD_* variables consistentlyJoerg Bornemann2020-11-208-41/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For consistency, apply the following renamings: QT_NO_MAKE_EXAMPLES -> QT_BUILD_EXAMPLES_BY_DEFAULT QT_NO_MAKE_TESTS -> QT_BUILD_TESTS_BY_DEFAULT QT_NO_MAKE_TOOLS -> QT_BUILD_TOOLS_BY_DEFAULT BUILD_EXAMPLES -> QT_BUILD_EXAMPLES BUILD_TESTING -> QT_BUILD_TESTS This should help to better convey the difference between "BUILD" and "NO_MAKE". To configure tests, but not to build them by default, pass the following to CMake: -DQT_BUILD_TESTS=ON -DQT_BUILD_TESTS_BY_DEFAULT=OFF Analoguous for examples: -DQT_BUILD_EXAMPLES=ON -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF Tools can be excluded from the default build with: -DBUILD_TOOLS_BY_DEFAULT=OFF The variable BUILD_TESTING is still available and initialized with the value of QT_BUILD_TESTS. Change-Id: Ie5f29dfbdca8bfa8d687981dfe8c19c0397ca080 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit fb21a5ce1a5831fab2af5e4d301600d6a6211e5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Don't install pri and debug info for bundled harfbuzz and pcre2Li Xinwei2020-11-201-11/+11
| | | | | | | | | | | | For shared build, Qt6BundledHarfbuzz.lib and Qt6BundledPcre2.lib are not installed. But their pri files(qt_ext_harfbuzz.pri, qt_ext_pcre2.pri) and debug info files(Qt6BundledHarfbuzz.pdb, Qt6BundledPcre2.pdb) are still installed. These files should not be installed too. Change-Id: I3e54bec01d94ee3897b485a982d01b24edc602aa Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 3ef32ce901490bb40a87bf6de19748045a605c05) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Generate less pri files and mark header modules as no_linkCristian Adam2020-11-202-5/+9
| | | | | | | | | | | | Plugins will no longer get .pri files generated in non-static builds. Header modules are now marked in the .pri files as CONFIG += no_link. Fixes: QTBUG-88221 Change-Id: I06e31fa970ad021261c43ca3acd88055cc4c9555 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 98e6234bd4a910ab1b3873bafc9da33aab499e2e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Toplevel builds: Add utility toplevel targets for each moduleVolker Hilsheimer2020-11-201-0/+47
| | | | | | | | | | | | Add a target for each level-1 subdirectory in a module. Ninja already generates phony targets such as "qtbase/src/all", but those are not available in e.g. IDE integrations of CMake. With this addition, targets like qtbase, qtbase_src, and qtbase_tests are available in IDEs. Change-Id: If1c3369e9413b3ce127e68c443d4d22949708d5e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 08f46bb40075778e89ba9aed3cef53d990852022) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix Android top-level prefix buildJoerg Bornemann2020-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | During a top-level prefix build, while configuring qtsvg, Qt6BuildInternalsConfig tries to include QtBuildInternalsAndroid.cmake but such files are not copied by qt_copy_or_install() at configure time. We need to use the "module" form of include() to take CMAKE_MODULE_PATH into account. Then QtBuildInternalsAndroid.cmake can be loaded from the source tree. The include's current form was introduced in commit 3cb9ee3a5b36e2c10dbaf1564852472e7e02a1ae without further explanation. Assuming an accidental change. Task-number: QTBUG-88460 Change-Id: If06ac715fae3c2bebbeffca44b7e07265ffb0f71 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 9e0fb9c4fbe7a11c09a70d7ea1be97405c6bf0f8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Change way of 'INPUT_' values handlingAlexey Edelev2020-11-201-9/+13
| | | | | | | | | | | | | Move 'INPUT_' variable detection logic out of 'qt_feature_set_cache_value' function. Use 'INPUT_' variable to enable/disable related 'FEATURE_' in case if 'FEATURE_' is not defined. Fixes: QTBUG-88501 Change-Id: I1162ac0fb562036898a37b52c3f80229ec8a0970 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 85f0792d2b10994e9e5fa70de50aa0ac39e98e20) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Rename the qt resource properties to be internalAlexandru Croitor2020-11-192-4/+4
| | | | | | | | | Use lowercase underscored property names. This ensures they will continue to work even for INTERFACE libraries if it ever comes to that. Change-Id: I5281070f25c1eb9f591c79af8b7fa6169c7c0fb7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Extract resource object file recording into new functionAlexandru Croitor2020-11-191-21/+25
| | | | | | | | | | This function will be used by qtdeclarative CMake functions to record resource object file information for Qml-specific generated resources (like the ones containing qmldir and qml files). Task-number: QTBUG-87702 Change-Id: I17c295821775d005dea82d9fbdf83d7ee613f615 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix resource objects story in static prl filesAlexandru Croitor2020-11-192-26/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CMake build of Qt intends to improve the developer experience in regards to static Qt builds and Qt resource files. Specifically with a CMake build of Qt, Qt developers don't have to manually call Q_INIT_RESOURCE anymore. For details see the following commits e343affd6345ef8db041789a96016c3a84830dc9 e817ac3d68295fc0670ccede4df08bf1c7e627d2 4ab54320817ebbb465af343514d21139a654aed3 The last commit's implementation is incomplete though. To ensure successful linking, each target's prl file should contain not only the resource object files that are assigned to the target, but also all resource object files of the target's dependencies. To achieve that, qt_collect_libs will now recursively collect all resource object files assigned to the QT_RCC_OBJECTS property of each dependency. Note this implementation is still incomplete. We do not export rcc object file information in the CMake Targets files. That means that when configuring qtdeclarative in a non-top-level build, the generated Qml prl file will not contain references to Core's mimetypes resource object file, etc. So with the current change, only the object files that are part of the current CMake configuration build are tracked. Exporting the resource object files locations proves in a format usable for prl files proves to be difficult (due to CMake not supporting exporting genexes in random properties) and will have to be addressed in a separate change. Amends 4ab54320817ebbb465af343514d21139a654aed3 Task-number: QTBUG-88425 Change-Id: I546655bdfdf7aa86a8df9aadfc054fa415130a33 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Refactor parts of qt_internal_walk_libsAlexandru Croitor2020-11-192-13/+64
| | | | | | | | | | | | | | | | | | | | | | | | Refactor the function in preparation of processing rcc object files. Introduce 2 new functions to get and set values in the memoization dictionary used by qt_internal_walk_libs. Modify qt_internal_add_target_aliases to assign the alias names it creates as properties on the target. Extract these aliases when available to assign memoized values not only for the initial library name, but also for its aliases. When recursively calling qt_internal_walk_libs, make sure to provide a unique out_var name based on the outer target name, and not just lib_libs. Otherwise the out_var values would be polluted from previous recursion runs. Make sure to check for -NOTFOUND in if() checks so that we reuse memoized values that are the empty string. Change-Id: I8fd8e2b0ae14d0ba8f502bc5a764d6e01095001a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix missing dependencies in *Depends headersJoerg Bornemann2020-11-192-3/+14
| | | | | | | | | | | | | | | In qt_internal_create_module_depends_file we're checking the target property INTERFACE_MODULE_HAS_HEADERS. However, this property is not exported, and in per-repo builds we do not have access to this. As we cannot export INTERFACE_* properties, we export another one, called _qt_module_has_headers. This amends commit 598e873c84e6544aa67495b9b9fb1ff22f98a293. Fixes: QTBUG-88503 Change-Id: I04b3e24add6e95b577a049c80683b7361ff72f59 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Make paths in qt-cmake-standalone-test relativeAlexey Edelev2020-11-171-14/+21
| | | | | | | | Make paths in qt-cmake-standalone-test relative to script's PWD. Fixes: QTBUG-88380 Change-Id: I6ab507c31ebed391f4e85bc6fe3f7f747dd97d54 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Enable exceptions by defaultMårten Nordheim2020-11-161-3/+7
| | | | | | | | Without breaking currently generated CMakeLists Fixes: QTBUG-88549 Change-Id: Ibda643e1374d9024bf693c12de8ec0ac46e09b7b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix configure not to pass clang compilers for AndroidAlexandru Croitor2020-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | That breaks configuration with CMake version 3.18.x (but not 3.19 for some reason). Specifically configure ends up passing -DCMAKE_CXX_COMPILER=clang++ which overrides the compiler set by the CMake Android toolchain file, and at the very end of CMake's configuration it complains about You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. The following variables have changed: CMAKE_CXX_COMPILER= clang++ Which suddenly starts another configuration with the modified compilers, ends up detecting host compilers and libraries and basically everything breaks apart. Fix QtProcessConfigureArgs.cmake not to pass the compiler options if the mkspec contains 'android'. Who knows, we might need this for other platforms too at some point. Task-number: QTBUG-88460 Change-Id: Idd57870a7cb1009a4e7802e5b3d5ac735f2dacf6 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Install missing debug info for some executable filesLi Xinwei2020-11-161-0/+3
| | | | | | | | | | | | | | | | | Although many executable files were generated by qt_internal_add_tool(). Some executable files like designer and androiddeployqt were generated by qt_internal_add_app(). Some executable files like windeployqt were generated by qt_internal_add_executable(). For these executable files, their PDB files won't be installed on MSVC platform, and their separate debug info won't be generated and installed on other platforms. To fix this, qt_enable_separate_debug_info() and qt_internal_install_pdb_files() should also be called in qt_internal_add_executable(). Fixes: QTBUG-88268 Change-Id: Id6a3b5842dba325166e3d696701c82ad942bca74 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* update KDE-ECM CMake modules to include fuzzer sanitizerAndreas Buhr2020-11-141-1/+10
| | | | | | | | | | | Updates one 3rdparty CMake file from https://github.com/KDE/extra-cmake-modules to include support for fuzzing. Task-number: QTBUG-88429 Change-Id: I19e7ed3c5602c34ba4b86e6b0df2ea3047c7c9e6 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Install pdb files to proper directories in multi-config buildLi Xinwei2020-11-141-2/+16
| | | | | | | | | | | | | | In multi-config build, for different configs, the pdb files of EXEs should have different installation directories. For example, when CMAKE_CONFIGURATION_TYPES=RelWithDebInfo;Debug, <build_dir>/bin/moc.pdb will be installed to <install_dir>/bin/moc.pdb. <build_dir>/bin/Debug/moc.pdb should be installed to <install_dir>/bin/Debug/moc.pdb, not <install_dir>/bin/moc.pdb. Fixes: QTBUG-88268 Change-Id: Idc7c92ca8d44bb81d990656af2b309306a4f5c6b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: fix running Android testsAssam Boudjelthia2020-11-122-8/+9
| | | | | | | | | | | | Android *.so files need to CXX visibility to default after qt_set_common_target_properties() which was setting it to hidden. Also, pass the correct androidtestrunner arguments for cmake check target Fixes: QTBUG-88228 Change-Id: Ia29cdc9e65153c9669f3ec06f74a46f8fcd8c507 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Remove indirection via Startup target for EntryPointTor Arne Vestbø2020-11-124-21/+3
| | | | | | | | | | | | | The EntryPoint interface target now contains all the logic for what flags and optional static libraries to add when the entrypoint is enabled. The target property QT_NO_ENTRYPOINT can be used to disable the entrypoint. Change-Id: I9b14ff729366cd6307789c969ebd4b2ca19de77d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix Core -> Core dependency in static buildJoerg Bornemann2020-11-121-1/+1
| | | | | | | | | | | | | | | Fix the overly strict regex in qt_internal_create_module_depends_file to allow for - and _ in module names. We had the above mentioned dependency cycle, because the module name Core_qobject was translated to just Core, creating a Core -> Core dependency. Amends da7609e7d0592b76ccb7cfb6c3136267172dc6bf. Fixes: QTBUG-88437 Change-Id: I866f7ce31e9a1b92fe4c0a6450295c2f3c761558 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>